Skip to content

[ Widget Preview ] Crashes when flutter config --no-enable-web is set #178486

@bkonyi

Description

@bkonyi

If a user has set flutter config --no-enable-web, the widget previewer will crash on launch with one of the two following errors:

flutter widget-preview start:

Error: Failed to locate browser. Make sure you are using an up-to-date Chrome or Edge. Otherwise, consider running with --web-server instead.

flutter widget-preview start --web-server:

StateError: Bad state: No element

#0      List.single (dart:core-patch/growable_array.dart:362:22)
#1      WidgetPreviewStartCommand.runPreviewEnvironment (package:flutter_tools/src/commands/widget_preview.dart:404:26)
<asynchronous suspension>
#2      WidgetPreviewStartCommand.runCommand (package:flutter_tools/src/commands/widget_preview.dart:344:24)
<asynchronous suspension>
#3      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1559:27)
<asynchronous suspension>
#4      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
<asynchronous suspension>
#5      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#6      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:487:9)
<asynchronous suspension>
#7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
<asynchronous suspension>
#8      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:422:5)
<asynchronous suspension>
#9      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:101:11)
<asynchronous suspension>
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:154:19)
<asynchronous suspension>
#11     main (package:flutter_tools/executable.dart:103:3)
<asynchronous suspension>

Metadata

Metadata

Assignees

Labels

P2Important issues not 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