-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: widget previewsIssues related to the Widget Previewer toolingIssues related to the Widget Previewer toolingteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Description
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.
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: widget previewsIssues related to the Widget Previewer toolingIssues related to the Widget Previewer toolingteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team