Repository navigation
[flutter_tools] Auto-detection of unsound null safety should fail for web dev builds #118331
Copy link
Copy link
Closed
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featurefound in release: 3.7Found to occur in 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyr: 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
Activity
- addedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jan 12, 2023 Reproducible using the code sample below.
code sample
// @dart = 2.11 import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({Key key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: const MyHomePage(title: 'ReorderableListView + Dismissible Items'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({Key key, @required this.title}) : super(key: key); final String title; @override State<MyHomePage> createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: const Center( child: Text('some text'), ), ); } }
logs
Launching lib/main.dart on Chrome in debug mode... This app is linked to the debug service: ws://127.0.0.1:50964/TFe4lan2NJg=/ws Debug service listening on ws://127.0.0.1:50964/TFe4lan2NJg=/ws Running without sound null safety ⚠️ Dart 3 will only support sound null safety, see https://dart.dev/null-safety Connecting to VM Service at ws://127.0.0.1:50964/TFe4lan2NJg=/wsLaunching lib/main.dart on macOS in debug mode... --- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:macOS, arch:arm64, id:00008103-000329201AD1001E } { platform:macOS, arch:x86_64, id:00008103-000329201AD1001E } : Error: Library doesn't support null safety. // @dart = 2.11 ^^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception Command PhaseScriptExecution failed with a nonzero exit code ** BUILD FAILED ** Exception: Build process failed ExitedLaunching lib/main.dart on iPhone 14 in debug mode... Updating project for Xcode compatibility. Upgrading project.pbxproj Upgrading Runner.xcscheme Removing script build phase dependency analysis. Xcode build done. 34.7s Failed to build iOS app Error (Xcode): lib/main.dart:1:1: Error: Library doesn't support null safety. Could not build the application for the simulator. Error launching application on iPhone 14. Exitedflutter doctor -v
[!] Flutter (Channel master, 3.7.0-19.0.pre.13, on macOS 13.1 22C65 darwin-arm64, locale en-GB) • Flutter version 3.7.0-19.0.pre.13 on channel master at /Users/nexus/dev/sdks/flutters ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path. ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision f8628b5cb1 (4 hours ago), 2023-01-11 18:48:03 -0800 • Engine revision 4a8d6866a1 • Dart version 3.0.0 (build 3.0.0-112.0.dev) • DevTools version 2.20.0 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/nexus/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14C18 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) [✓] VS Code (version 1.74.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.56.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 13.1 22C65 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.87 [✓] HTTP Host Availability • All required HTTP hosts are available ! Doctor found issues in 1 category.- addedtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.platform-webWeb applications specificallyWeb applications specificallyhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work ona: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featurefound in release: 3.7Found to occur in 3.7Found to occur in 3.7and removedin triagePresently being triaged by the triage teamPresently being triaged by the triage team
on Jan 12, 2023 - addedP1High-priority issues at the top of the work listHigh-priority issues at the top of the work list
on Jan 17, 2023 - addedr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
on Jan 19, 2023 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.- locked as resolved and limited conversation to collaborators
on Mar 4, 2023
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: null-safetySupport for Dart's null safety featureSupport for Dart's null safety featurefound in release: 3.7Found to occur in 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyWeb applications specificallyr: 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.
Any application that requires unsound null safety should be forced to pass an explicit flag when running
flutter run -d chrome. Auto-detecting unsound null safety should be an error.It sounds like this is working as intended for all implementations except development mode for the web (JS compiler).
I reproduction case should be to create an app and add a language version comment to the library that contains the entrypoint:
Then run
flutter run -d chrome. It prints a warning but that should be an error.Running with the explicit flag:
flutter run -d chrome --no-sound-null-safetyshould still work with a warning.