Repository: flutter
Issue: multiple decompressLicenses isolates during debug sessions
Labels: tool,framework,t: hot reload,a: debugging,P2,team-tool,triaged-tool

### Steps to reproduce

I"m debugging my flutter app on linux (ubuntu)  and every now and them I"m seeing a large number of isolates spawned with  debug names such as decompressLicenses, parseLicenses.



When this occurs my debug session becomes unresponsive until the isolates finish.
I've tried pausing the isolates to see what is going on but the debugger doesn't show a stacktrace.

Having googled for the above isolate names I found that it is part of the core flutter code in service bindings.

These isolates take a long to to run to completion (in the order of a minute).

https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/services/binding.dart

I'm using a large number of packages :

```yaml
name: hmb
description: "Hold My Beer - I'm a handyman. Customer, Job management and billing for sole handymen."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.6.24

environment:
  sdk: '>=3.5.0 <4.0.0'

dependencies:
  app_links: ^6.1.4
  archive: ^3.6.1
  camera_platform_interface: ^2.8.0
  camera_windows: ^0.2.6
  completer_ex: ^4.0.3
  country_code:
    hosted: https://onepub.dev/api/jbbxpsdavu/
    version: ^1.1.0
  date_time_format: ^2.0.1
  datetime_picker_formfield: ^2.0.1
  dcli: ^6.0.5
  dcli_core: ^6.0.3
  direct_caller_sim_choice: ^1.0.5
  dlibphonenumber: ^1.1.18
  email_validator: ^3.0.0
  equatable: ^2.0.0
  ffi: ^2.1.2
  file_picker: ^8.0.5
  fixed: ^5.0.1
  fleather: ^1.17.0
  flutter:
    sdk: flutter

  flutter_colorpicker: ^1.1.0
  flutter_email_sender: ^6.0.3
  flutter_secure_storage: ^9.2.2
  flutter_secure_storage_linux: ^1.2.1
  flutter_svg: ^2.0.14
  future_builder_ex: ^4.0.0
  go_router: ^14.2.0
  google_mlkit_barcode_scanning: ^0.13.0
  google_sign_in: ^6.2.1
  googleapis: ^13.1.0
  googleapis_auth: ^1.6.0
  halfpipe: ^1.0.1
  http: ^1.2.1
  image_picker: ^1.1.1
  image_picker_platform_interface: ^2.10.0
  image_picker_windows: ^0.2.1+1
  infinite_calendar_view: ^1.0.2
  intl: ^0.19.0
  json_annotation: ^4.9.0
  june: ^1.0.0+1
  logger: ^2.4.0
  mailto: ^2.0.0
  mobile_number: ^2.1.1
  mockito: ^5.4.4
  money2: ^5.4.1
  oauth2: ^2.0.3
  package_info_plus: ^8.1.1
  parchment_delta: ^1.0.0
  pasteboard: ^0.2.0
  path: ^1.9.0
  path_provider: ^2.0.0
  pdf: ^3.11.0
  pdfrx: ^1.0.82
  permission_handler: ^11.3.1
  photo_view: ^0.15.0
  printing: ^5.13.1
  provider: ^6.1.2
  sentry: ^8.11.0
  sentry_flutter: ^8.9.0
  sms_advanced: # ^1.1.0
    hosted: https://onepub.dev/api/jbbxpsdavu/
  sqflite: ^2.3.2
  sqflite_common: ^2.5.4+5
  sqflite_common_ffi: ^2.3.3+1
  sqflite_common_ffi_web: ^0.4.3+1
  stacktrace_impl: ^2.3.0
  strings: ^3.1.1
  svg_flutter: ^0.0.1
  toastification: ^2.0.0
  url_launcher: ^6.2.5
  wakelock_plus: ^1.2.8
  win32: ^5.5.1

dev_dependencies:
  args: ^2.5.0
  
  
  flutter_launcher_icons: ^0.14.0
  flutter_test:
    sdk: flutter
  lint_hard: ^5.0.0
  pub_release: ^11.0.0
  pubspec_manager: ^1.0.0

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  # flutter_lints: ^3.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  assets:
    - assets/sql/upgrade_scripts/
    - assets/sql/upgrade_list.json
    - assets/installer/linux/hmb.desktop


  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages


flutter_icons:
  android: true
  ios: true
  macos: true
  windows: true
  linux: true
  web: true
  image_path: "assets/icons/hmb_app_icon.webp"
```

Interestingly enough I can trigger the problem by navigating to a particular screen in my app.
This bit is particulalry weird as I change from using a Card/ListTile
```dart
  Widget _buildTotals() => Card(
        margin: const EdgeInsets.all(8),
        child: ListTile(
          title: const Text('Totals'),
          subtitle: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text('Labour: $_totalLabourCost'),
              Text('Materials: $_totalMaterialsCost'),
              Text('Combined: $_totalCombinedCost'),
            ],
          ),
        ),
      );
```
to my own SurfaceCard
```dart

class SurfaceCard extends StatelessWidget {
  const SurfaceCard({
    required this.title,
    required this.body,
    this.height,
    this.onPressed,
    this.elevation = SurfaceElevation.e4,
    this.padding = const EdgeInsets.all(HMBTheme.padding),
    super.key,
  });

  final String title;
  final Widget body;

  final double? height;

  final void Function()? onPressed;

  final SurfaceElevation elevation;
  final EdgeInsetsGeometry? padding;

  @override
  Widget build(BuildContext context) => GestureDetector(
        onTap: onPressed,
        child: Container(
            height: height,
            color: elevation.color,
            padding: padding,
            child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [HMBTextHeadline(title), Expanded(child: body)])),
      );
}

```
That singular change causes these isolates to spool up (I've proven this by flipping between the two versions of code).

I'm not asking about my layout issue, I can fix that, but it shouldn't trigger this odd behaviour.

```
Cannot hit test a render box that has never been laid out.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by gestures library ══════════════════════════════════
Cannot hit test a render box that has never been laid out.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by gestures library ══════════════════════════════════
Cannot hit test a render box that has never been laid out.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by gestures library ══════════════════════════════════
Cannot hit test a render box that has never been laid out.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by gestures library ══════════════════════════════════
Cannot hit test a render box that has never been laid out.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by scheduler library ═════════════════════════════════
'package:flutter/src/rendering/mouse_tracker.dart': Failed assertion: line 203 pos 12: '!_debugDuringDeviceUpdate': is not true.
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by gestures library ══════════════════════════════════
Cannot hit test a render box that has never been laid out.
════════════════════════════════════════════════════════════════════════════════

```

If I fix the layout issue, the problem goes away.

### Expected results

Only one isolate should be spawned to process licenses.

### Actual results

about a dozen isolates are spawned.

### Code sample

<details open><summary>Code sample</summary>

```dart
[Paste your code here]
```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

![Screenshot from 2024-12-26 08-51-55](https://github.com/user-attachments/assets/0917f5fe-558b-4bbc-8ef7-92145e4cd0c1)


</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.1, on Ubuntu 24.04.1 LTS 6.8.0-48-generic, locale en_AU.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/to/linux-android-setup for more details.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2024.2)
[!] Android Studio (version unknown)
    ✗ Unable to determine Android Studio version.
    ✗ android-studio-dir = /home/bsutton/Android/Sdk
    ✗ Unable to find bundled Java version.
[✓] VS Code (version 1.95.3)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 2 categories.
```

</details>