I connected the package, added it to main.dart, I try to compile the application, but I get this error. Help! What should I do about it?
error
Launching lib\main.dart on XT1562 in debug mode...
Running Gradle task 'assembleDebug'...
/D:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.18.1/lib/src/picture_provider.dart:50:59: Error: No named parameter with the name 'nullOk'.
context != null ? Localizations.localeOf(context, nullOk: true) : null,
^^^^^^
/D:/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
static Locale localeOf(BuildContext context) {
^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1
Follow the steps below
flutter_svg: ^0.20.0-nullsafety.3
flutter clean
commandflutter pub get
commandflutter run
command or run the projectEveryone is right: putting flutter_svg: ^0.20.0-nullsafety.3
or flutter_svg: ^0.19.3
(in case you can't migrate to null safety yet) is the solution.
I want to add a little thing: if you're using a package which depends on flutter_svg and you still get the error due to older versions usage, you can fix it in this way:
dependency_overrides:
flutter_svg: ^0.19.3
I lost plenty of time because the flags: ^3.2.2
package was using flutter_svg: ^0.19.1
and it led to the same error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With