Are you experiencing the “Could not find an option named no-sound-null-safety” error in Flutter?
We’re going to learn how to easily fix it in this article.
What causes the “Could not find an option named no-sound-null-safety” error?
The “Could not find an option named no-sound-null-safety” happens in a newer Flutter project using Dart 3.0, because Dart no longer supports unsound null safety.
Unsound null safety was a special Dart/Flutter feature where there are no static checks to ensure that we don’t access nullable variables – variables that may be null
.
It allowed developers to migrate their codebase to the default null safety gradually without breaking existing code that depended on null-unsafe libraries.
But from version 3.0 upwards, Dart only supports code using sound null safety.
Fix “Could not find an option named no-sound-null-safety” (general)
To fix the “Could not find an option no-sound-null-safety” Flutter error, remove the --no-sound-null-safety
option in your flutter run
command.
Fix “Could not find an option named no-sound-null-safety” in VS Code
To fix the error in Visual Studio Code remove the --no-sound-null-safety
option in the Dart: Flutter Additional Args
setting.
You can use the Ctrl + ,
keyboard shortcut to quickly open the Settings page.