This application is not configured to build on the web.
To add web support to a project, run flutter create ..
Launching lib\main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
package:flutter_speed_dial
For solutions, see https://dart.dev/go/unsound-null-safety
Unhandled exception:
You will need at least version 3.0.0 of that package to have null safety.
Given that they are at version 5.0.0 right now, you should probably update your packages every once in a while.
If you want to run without latest version you need to Update the Configuration File,
Edit Configuration
Then,
Add --no-sound-null-safety in Additional run args.
Add Command in Additional run args
Then, Click Apply and Run the app.
Edited:
you will need to latest version and if you want to run without latest version you need to run this command
$ flutter run --no-sound-null-safety
Related
I have shifted my entire code to latest dart version 2.15.1. Now I am trying to run the code and it is giving this error.
Image1
Why I am getting this error. Anyone please help me.
Thanks
This is because some of your dependencies that you are using in your project doesn't support null-safety or Your project itself doesn't support null-safety but using dependencies that supports null-safety. To get rid of this problem you can try upgrading the dependency that is causing the error and if there's no update available for that plugin that run your project using below command :
To Run
flutter run --no-sound-null-safety
To Build
flutter build apk --release --no-sound-null-safety
This error comes when your project or package is not supported on null safety
when you are trying to run the project its gives you an error which you see in your picture
if you want to run without null safety use this command
flutter run --no-sound-null-safety
when you hit this command on your project it should be run if you face any error kindly comment
Press Run
Edit Configurations
Add Additional Run args
--no-sound-null-safety
I just ran into this. I tried to build for Windows and got the null-safety error but the output did not say which packages were the problem, it just showed several paths to Visual Studio.
I then tried to build for Chrome and it did list the packages that did not support null-safety. Hope this helps.
in my case i just type the major version avalaible for the dependency and it works!
from
shared_preferences:
to
shared_preferences: ^2.0.16
With the flutter pub update command, it threw me a reference to the shared_preferences dependency and after investigated options I saw this solution and applied it and it worked fine
I'm seeing that I can introduce a compilation error in my dart code but flutter build ios will still successfully run. If I flutter run -d [my-simulator] the compile error will immediately be presented in a red screen on the simulator but I can't currently easily do this in a CI type check.
Is there are cli command I can run to ensure that all of the dart code is free of compile errors?
You can run dart analyze or flutter analyze commands.
More info
I am new to flutter and I got this error when I tried to run the flutter run command. I found many articles related to this issue and got to know that flutter run --no-sound-null-safety is the solution to this issue during development. But my question is that What if I get this error during the production build? How can I handle it there?
flutter build <target> --no-sound-null-safety works too (as does flutter test --no-sound-null-safety FYI).
Note that this is a compilation error. If it fails, you won't get your APK (or whatever you're targeting), so this is not something you need to worry about happening "in production".
However, if you're new to Flutter, and the project is still young, consider trying to remove the null-unsafe dependencies. The command flutter pub outdated --mode=null-safety will give you info on which packages don't support null safety, and whether they can be upgraded.
After sound null safety has arrived, projects that still have dependencies that have not upgraded to null safety yet, can still be run using --no-sound-null-safety flag through the Flutter command.
But now I am trying to run the app through the android project. The reason why I am trying to do this way is to allow me to debug a native Flutter plugin. I open the folder android on Android Studio and when I try to run the project I receive an error:
Error: Cannot run with sound null safety, because the following dependencies don't support null safety:
If I was running through the Flutter command, the flag I mentioned would work here. But how do I set this flag when running the android project through Android Studio?
Change your edit configurations.
Add the flag --no-sound-null-safety
After searching a little more I found the solution to this problem. You do not need to run the project through Android Studio, you can run it with the Flutter command and then attach the debugger using Android Studio.
Reference: https://stackoverflow.com/a/58760445/8633918
I'm new to flutter, when I created a new project of flutter and run it, this appears :
Using hardware rendering with device AOSP on IA Emulator. If you notice graphics artifacts,
consider enabling software rendering with "--enable-software-rendering".
Launching lib\main.dart on AOSP on IA Emulator in debug mode...
Could not find a command named "-".
Usage: dart [<vm-flags>] <command|dart-file> [<arguments>]
Global options:
-h, --help Print this usage information.
-v, --verbose Show additional command output.
--version Print the Dart SDK version.
--enable-analytics Enable anonymous analytics.
--disable-analytics Disable anonymous analytics.
Available commands:
analyze Analyze the project's Dart code.
compile Compile Dart to various formats.
create Create a new project.
fix Apply automated fixes to Dart source code.
format Idiomatically format Dart source code.
migrate Perform a null safety migration on a project or package.
pub Work with packages.
run Run a Dart program.
test Run tests in this package.
Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 510ms
Exception: Gradle task assembleDebug failed with exit code 64
I'm stuck with this problem, how to solve this?
I have solved this problem. I run this project in my D: directory while my flutter and android SDK was installed in C: directory. So, when I tried to create flutter project in C:, it worked. But, I still can't configure why this problem happened.
#Papskipapap may I ask, if running your project on D: also inculded some path name which contained a "-" (dash) in it? As a rule of thumb: Keep pathnames easy, i.e. without blanks or special characters other than "_" (underscore), many tools just can not handle those...