Skip to content

[ Widget Preview ] Running flutter pub get after adding a plugin dependency causes the previewer to crash #178317

@bkonyi

Description

@bkonyi

To reproduce:

  • Run flutter widget-preview start --web-server in a Flutter project directory
  • Add a plugin package dependency to the pubspec.yaml
  • Run flutter pub get

This will cause the flutter widget-preview process to repeatedly crash with an exception similar to the following:

Oops; flutter has exited unexpectedly: "Bad state: Unable to find the context to
/Users/bkonyi/samples/background_isolate_channels/linux/flutter/ephemeral/.plugin_symlinks/shared_preferences_linux/test/shared_preferences_linux_async_test.dart".

Stack trace:

#0      AnalysisContextCollectionImpl.contextFor (package:analyzer/src/dart/analysis/analysis_context_collection.dart:177:5)
#1      PreviewDetector._onFileSystemEvent.<anonymous closure> (package:flutter_tools/src/widget_preview/preview_detector.dart:147:50)
#2      PreviewDetectorMutex.runGuarded (package:flutter_tools/src/widget_preview/utils.dart:99:35)
<asynchronous suspension>
#3      PreviewDetector._onFileSystemEvent (package:flutter_tools/src/widget_preview/preview_detector.dart:118:5)
<asynchronous suspension>

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: widget previewsIssues related to the Widget Previewer toolingteam-toolOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions