You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ Widget Preview ] Crash when adding or removing a pubspec.yaml from a subdirectory #179155
When adding or removing a pubspec.yaml while the widget previewer is running, it's possible to encounter the following crash:
Thread 0 main threadStateError: Bad state: No element
at ListBase.firstWhere(list.dart:132)
at PreviewManifest._calculatePubspecHashes(preview_manifest.dart:69)
at PreviewManifest.updatePubspecHash(preview_manifest.dart:146)
at PreviewPubspecBuilder.populatePreviewPubspec(preview_pubspec_builder.dart:174)
at <asynchronous gap>(async)
An example of this situation is a user creating a new workspace project in the previewed directory. The preview detection logic sees that a pubspec.yaml has been updated and attempts to update its hash code in the preview manifest. This is done by trying to find the first FlutterProject which has a pubspec at the location of the new pubspec.yaml. Since this project is new, the previewer isn't aware of it and the firstWhere(...) call throws since there's no match.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
[ Widget Preview ] Handle changes to unexpected pubspec.yaml files gr…
[ Widget Preview ] Handle changes to unexpected pubspec.yaml files gr…
[ Widget Preview ] Handle changes to unexpected pubspec.yaml files gr…
[ Widget Preview ] Handle changes to unexpected pubspec.yaml files gr…
[CP-stable][ Widget Preview ] Handle changes to unexpected pubspec.ya…
[ Widget Preview ] Handle changes to unexpected pubspec.yaml files gr…
[ Widget Preview ] Handle changes to unexpected pubspec.yaml files gr…
github-actions commentedon Dec 11, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.[ Widget Preview ] Handle changes to unexpected pubspec.yaml files gr…