-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featurea: qualityA truly polished experienceA truly polished experiencefound in release: 1.24Found to occur in 1.24Found to occur in 1.24has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versiontoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Description
Running simple Flutter apps with null safety from VSCode or Android Studio triggers a throw in the WidgetInspectorService:
Repro steps
- Create simple null safety app:
flutter create nulltest cd nulltest dart migrate --apply-changes --no-web-preview
- Attempt to build APK, forgetting the experiment flag:
flutter build apk
Actual result: A long build exception:
$ flutter build apk
You are building a fat APK that includes binaries for android-arm,
android-arm64, android-x64.
...
lib/main.dart:31:18: Error: This requires the null safety language feature, which is experimental.
You can enable the experiment using the '--enable-experiment=non-nullable' command line option.
MyHomePage({Key? key, this.title}) : super(key: key);
^
lib/main.dart:42:15: Error: This requires the null safety language feature, which is experimental.
You can enable the experiment using the '--enable-experiment=non-nullable' command line option.
final String? title;
^
lib/main.dart:74:33: Error: This requires the null safety language feature, which is experimental.
You can enable the experiment using the '--enable-experiment=non-nullable' command line option.
title: Text(widget.title!),
^
lib/main.dart:101:39: Error: This requires the null safety language feature, which is experimental.
You can enable the experiment using the '--enable-experiment=non-nullable' command line option.
style: Theme.of(context)!.textTheme.headline4,
^
FAILURE: Build failed with an exception.
* Where:
Script '/Users/mit/dev/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 900
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/mit/dev/flutter/bin/flutter'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 24s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 25.3s
Gradle task assembleRelease failed with exit code 1
Expected result: The error is caught, and a nicely formatted error is printed:
$ flutter build apk
You are building a fat APK that includes binaries for android-arm,
android-arm64, android-x64.
...
Build failed: There are 3 uses of the null safety language feature, which is experimental.
You can enable the experiment using the '--enable-experiment=non-nullable' command line option.
Error details:
lib/main.dart:31:18: Error: This requires the null safety language feature, which is experimental.
MyHomePage({Key? key, this.title}) : super(key: key);
^
lib/main.dart:42:15: Error: This requires the null safety language feature, which is experimental.
final String? title;
^
lib/main.dart:74:33: Error: This requires the null safety language feature, which is experimental.
title: Text(widget.title!),
^
lib/main.dart:101:39: Error: This requires the null safety language feature, which is experimental.
style: Theme.of(context)!.textTheme.headline4,
^
Version information
Flutter 1.24.0-3.0.pre • channel dev • https://github.com/flutter/flutter.git
Framework • revision 2783f8e2e1 (4 days ago) • 2020-10-22 09:36:06 -0700
Engine • revision defa8be2b1
Tools • Dart 2.11.0 (build 2.11.0-242.0.dev)
mit-macbookpro4:nulltest mit$
jiangxiaoqiang and spiderion
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featurea: qualityA truly polished experienceA truly polished experiencefound in release: 1.24Found to occur in 1.24Found to occur in 1.24has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versiontoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.