Skip to content

Errors don't inform the user of --no-sound-null-safety #44149

@mit-mit

Description

@mit-mit

Porting flutter/flutter#70145 by @tvolkert:


Steps to reproduce:

  1. Upgrade your app to null safety
  2. Introduce a package dependency for which the package has no null safe version
  3. Run flutter run

Expected results

You expect the error message to tell you both why it's unable to run in sound mode (because the dependencies aren't null safe) and how to get around the error (by running with --no-sound-null-safety).

Actual results

It tells you why it failed to build and how to inspect the package versions, but it doesn't tell you how to sidestep the problem for now...

> flutter run -t lib/main.dart -d iphone --debug
Running "flutter pub get" in payouts...                            458ms
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install...                                           1,746ms
Running Xcode build...                                                  
Xcode build done.                                           15.6s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    Error: This project cannot run with sound null safety, because one or more project dependencies do not
    support null safety:

     - package:http
     - package:intl
     - package:http_parser

    Run 'pub outdated --mode=null-safety' to determine if versions of your
    dependencies supporting null safety are available.

    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.

Sure enough, in this example, running flutter run --no-sound-null-safety ... allowed the app to run.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions