Repository: flutter
Issue: simple flutter test never ends with crossed exports
Labels: a: tests,framework,dependency: dart,P2,team-framework,triaged-framework

While working on [exporting public API types from painting library](https://github.com/flutter/flutter/pull/106936) I faced several failure in CI related to mixed export. I managed to reduce the diff of the PR to have a simpler reproduction I pasted below (I failed to reduce it only with dart).

It could be similar to #106332

## Steps to Reproduce

<!-- Please include full steps to reproduce so that we can reproduce the problem. -->

1. Checkout flutter main branch (on 8fe82bbe60 for me)
2. Apply the following [patch.diff](https://github.com/flutter/flutter/files/9028900/issue.diff.txt)

```diff
diff --git a/packages/flutter/lib/src/painting/inline_span.dart b/packages/flutter/lib/src/painting/inline_span.dart
index a0e6f898bb..8d6b57019a 100644
--- a/packages/flutter/lib/src/painting/inline_span.dart
+++ b/packages/flutter/lib/src/painting/inline_span.dart
@@ -12,6 +12,8 @@ import 'text_painter.dart';
 import 'text_span.dart';
 import 'text_style.dart';
 
+export 'text_style.dart' show TextStyle;
+
 /// Mutable wrapper of an integer that can be passed by reference to track a
 /// value across a recursive stack.
 class Accumulator {
diff --git a/packages/flutter/lib/src/painting/strut_style.dart b/packages/flutter/lib/src/painting/strut_style.dart
index 13cc7e767b..3c6a38af13 100644
--- a/packages/flutter/lib/src/painting/strut_style.dart
+++ b/packages/flutter/lib/src/painting/strut_style.dart
@@ -9,6 +9,8 @@ import 'package:flutter/foundation.dart';
 import 'basic_types.dart';
 import 'text_style.dart';
 
+export 'text_style.dart' show TextStyle;
+
 /// Defines the strut, which sets the minimum height a line can be
 /// relative to the baseline.
 ///
diff --git a/packages/flutter/lib/src/painting/text_painter.dart b/packages/flutter/lib/src/painting/text_painter.dart
index 2cbf171eb4..c68999b592 100644
--- a/packages/flutter/lib/src/painting/text_painter.dart
+++ b/packages/flutter/lib/src/painting/text_painter.dart
@@ -16,6 +16,8 @@ import 'text_span.dart';
 
 export 'package:flutter/services.dart' show TextRange, TextSelection;
 
+export 'inline_span.dart' show InlineSpan;
+
 // The default font size if none is specified. This should be kept in
 // sync with the default values in text_style.dart, as well as the
 // defaults set in the engine (eg, LibTxt's text_style.h, paragraph_style.h).
diff --git a/packages/flutter/lib/src/painting/text_span.dart b/packages/flutter/lib/src/painting/text_span.dart
index cd84097f69..afeb6ac14a 100644
--- a/packages/flutter/lib/src/painting/text_span.dart
+++ b/packages/flutter/lib/src/painting/text_span.dart
@@ -12,6 +12,8 @@ import 'basic_types.dart';
 import 'inline_span.dart';
 import 'text_painter.dart';
 
+export 'text_style.dart' show TextStyle;
+
 /// An immutable span of text.
 ///
 /// A [TextSpan] object can be styled using its [style] property. The style will
diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart
index 9a7468ff86..de20c3e875 100644
--- a/packages/flutter/lib/src/painting/text_style.dart
+++ b/packages/flutter/lib/src/painting/text_style.dart
@@ -11,6 +11,9 @@ import 'colors.dart';
 import 'strut_style.dart';
 import 'text_painter.dart';
 
+export 'strut_style.dart' show StrutStyle;
+export 'text_painter.dart' show TextOverflow;
+
 const String _kDefaultDebugLabel = 'unknown';
 
 const String _kColorForegroundWarning = 'Cannot provide both a color and a foreground\n'

```
3. Create a new flutter project with `flutter create my_test`
4. Run tests via `flutter test`

**Expected results:** no errors

**Actual results:** process is stuck and need to be killed

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
~/tmp/my_test$ flutter analyze
Analyzing my_test...                                                    
No issues found! (ran in 2.7s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
~/tmp/my_test$ flutter doctor -v
[✓] Flutter (Channel main, 3.1.0-0.0.pre.1423, on Ubuntu 20.04.4 LTS 5.4.0-120-generic, locale fr_FR.UTF-8)
    • Flutter version 3.1.0-0.0.pre.1423 on channel main at /home/xxx/dev/dart/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 8fe82bbe60 (il y a 2 jours), 2022-06-29 10:16:05 +0300
    • Engine revision 8c36371fa7
    • Dart version 2.18.0 (build 2.18.0-234.0.dev)
    • DevTools version 2.14.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/xxx/softwares/android-sdk-linux/
    • Platform android-31, build-tools 30.0.3
    • ANDROID_HOME = /home/xxx/softwares/android-sdk-linux/
    • Java binary at: /home/xxx/softwares/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Android Studio (version 2021.2)
    • Android Studio at /home/xxx/softwares/android-studio
    • Flutter plugin version 68.1.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] IntelliJ IDEA Community Edition (version 2020.3)
    • IntelliJ at /home/xxx/softwares/jetbrains/idea-IC-203.7148.57
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 203.6912

[✓] VS Code (version 1.68.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.42.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 20.04.4 LTS 5.4.0-120-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 102.0.5005.115

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>