Flutter - VSCode Run Error after upgrading to Flutter 3.10.0 and Dart 3.0

Phenomenon

Before VSCode, the project could run, but after upgrading to Flutter 3.10.0 and Dart 3.0, it suddenly failed to start, and the command line operation flutter runis possible.

The error is as follows:

screenshot 1

reason

As we all know, it was removed in Flutter 3.10.0 no-sound-null-safety, forcing global empty security. Flutter 3.10.0 release notes

screenshot 2

So how can VSCode still run the project?

solution

  1. VSCode Click the gear icon in the lower left corner, command panel;screenshot 3
  2. Enter settings.json ;screenshot 4
  3. --no-sound-null-safetyRemoved parameter from dart.flutterAdditionalArgs.

expand

At the same time, in the search project sound-null-safety, no-sound-null-safetythe places with and parameters need to be deleted.

Guess you like

Origin juejin.im/post/7233695223401168953