Flutter_svg: No named parameter with the name 'nullOk'.

Created on 26 Jan 2021  Â·  36Comments  Â·  Source: dnfield/flutter_svg

../../../../.pub-cache/hosted/pub.flutter-io.cn/flutter_svg-0.19.2+1/lib/src/picture_provider.dart:57:59: Error: No named parameter with the name 'nullOk'.
context != null ? Localizations.localeOf(context, nullOk: true) : null,

[✓] Flutter (Channel master, 1.26.0-13.0.pre.163, on Mac OS X 10.15.7 19H114
darwin-x64, locale zh-Hans-CN)
• Flutter version 1.26.0-13.0.pre.163 at
/Users/m6/Downloads/tools/flutter_sdk/flutter
• Framework revision b4f69eb7eb (3 hours ago), 2021-01-25 19:17:29 -0500
• Engine revision ee07d1b448
• Dart version 2.12.0 (build 2.12.0-256.0.dev)
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn

Most helpful comment

For my friends in the trenches:

flutter_svg:
    git:
      url: git://github.com/gskinnerTeam/flutter_svg.git
      ref: 12b55b464d2e253f411a17798527a7daa2c00ceb

https://github.com/gskinnerTeam/flutter_svg/tree/nnbd-fix

All 36 comments

I have the same problem. Downgrading to previous flutter_svg version is not working.

You need to upgrade to the 0.20.x version to use it on the master channel of flutter.

Me too

~/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.19.2+1/lib/src/picture_provider.dart:57:59: Error: No named parameter with the name 'nullOk'.
    context != null ? Localizations.localeOf(context, nullOk: true) : null,
                                                        ^^^^^^
/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) {

Upgrading to 0.20.0-nullsafety conflicts with cached_network_image package.

pub get failed (1; So, because wpn_app depends on both cached_network_image ^2.5.0 and flutter_svg ^0.20.0-nullsafety, version solving failed.)

It'd be helpful to know which package(s) are causing conflicts there - it might be something I can adjust here, but likely something that has to be changed in cached_network_image.

Also got a problem when upgrading to 0.20.x versions but with flutter_launcher_icons

Running "flutter pub get" in my-app...                        
The current Dart SDK version is 2.12.0-257.0.dev.


Because flutter_launcher_icons <0.4.0 requires SDK version >=1.20.1 <2.0.0 and flutter_launcher_icons >=0.7.1 depends on image ^2.1.1, flutter_launcher_icons <0.4.0-∞ or >=0.7.1 requires image ^2.1.1.


And because flutter_launcher_icons >=0.4.0 <0.7.1 depends on image ^2.0.0, every version of flutter_launcher_icons requires image ^2.0.0.
And because image >=1.1.31 <2.0.6 depends on xml >=2.0.0 <4.0.0 and image >=2.0.6 <2.1.14 depends on xml ^3.2.5, every version of flutter_launcher_icons requires xml >=2.0.0 <4.0.0 or image ^2.1.14.
And because image >=2.1.14 <3.0.0-nullsafety.0 depends on xml ^4.2.0 and flutter_svg >=0.20.0-nullsafety.0 depends on xml ^5.0.0-nullsafety.0, flutter_launcher_icons is incompatible with flutter_svg >=0.20.0-nullsafety.0.
So, because my_app depends on both flutter_svg ^0.20.0-nullsafety.2 and flutter_launcher_icons any, version solving failed.

@PinkiNice -

You'll want to do one of two things.

  1. Ideally, get all of your deps to migrate to nullsafety. In this case, you want flutter_launcher_icons to migrate.
  2. Less ideally, use dependency overrides to make it all work out. For example, you can override image to the new nullsafe version released yesterday, or override xml to the new nullsafe version released a few months back. Although these are marked as breaking changes, I believe they might still work with the constraints your packages want.

I guess a third option exists: I could try to release a 0.19.x version that's compatible with the non-nullsafe packages _and_ the latest API changes in Flutter.

I'd like to avoid that if possible - it creates more work for me and puts less pressure on the ecosystem to migrate to nullsafety :)

You can also try running flutter pub outdated --mode=null-safety to have pub tell if you if there are pre-release nullsafe packages available for you.

Hi @dnfield I also encountered the same problem, but I resolve it by upgrading the package to pre-release version,

however, I got a great deal of warning after that....

but it kind of unlikely anything mentioned in the warning log is one of my dependencies, for example, I don't have anything like win32-1.7.4 or ffi-0.1.3

And this is the log, thank you so much for taking time to looking into the issue!


Warning Log

../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:1111:7: Info: Struct 'ENUMLOGFONTEX' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class ENUMLOGFONTEX extends Struct {
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2835:7: Info: Struct 'BLUETOOTH_PIN_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class BLUETOOTH_PIN_INFO extends Struct {
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2960:7: Info: Struct 'EXCEPINFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class EXCEPINFO extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2966:7: Info: Struct 'PROPERTYKEY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class PROPERTYKEY extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2973:7: Info: Struct 'PROPVARIANT' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class PROPVARIANT extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2978:7: Info: Struct 'SAFEARRAY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class SAFEARRAY extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2985:7: Info: Struct 'CLSID' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class CLSID extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2992:7: Info: Struct 'STATSTG' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class STATSTG extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2999:7: Info: Struct 'NLM_SIMULATED_PROFILE_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class NLM_SIMULATED_PROFILE_INFO extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart:23:7: Info: Struct 'Utf8' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class Utf8 extends Struct {
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf16.dart:16:7: Info: Struct 'Utf16' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class Utf16 extends Struct {
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/allocation.dart:47:33: Info: Support for using non-constant type arguments 'T' in this FFI API is deprecated and will be removed in the next stable version of Dart. Rewrite the code to ensure that type arguments are compile time constants referring to a valid native type.
  final int totalSize = count * sizeOf<T>();
                                ^
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...
Unhandled exception:
Invalid argument(s): A directory corresponding to fileSystemPath "/Users/benjaminli/.pub-cache/hosted/pub.dartlang.org/devtools-0.9.7+1/build" could not be found
#0      createStaticHandler (package:shelf_static/src/static_handler.dart:50:5)
#1      defaultHandler (package:devtools_server/src/external_handlers.dart:40:23)
<asynchronous suspension>
#2      serveDevTools (package:devtools_server/src/server.dart:183:15)
<asynchronous suspension>
#3      serveDevToolsWithArgs (package:devtools_server/src/server.dart:72:10)
<asynchronous suspension>
Failed to launch DevTools: TimeoutException after 0:00:10.000000: Future not completed

Debug service listening on ws://127.0.0.1:56023/ZPBWTL3qVxU=/ws
Syncing files to device sdk gphone x86 arm...
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:1111:7: Info: Struct 'ENUMLOGFONTEX' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class ENUMLOGFONTEX extends Struct {
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2835:7: Info: Struct 'BLUETOOTH_PIN_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class BLUETOOTH_PIN_INFO extends Struct {
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2960:7: Info: Struct 'EXCEPINFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class EXCEPINFO extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2966:7: Info: Struct 'PROPERTYKEY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class PROPERTYKEY extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2973:7: Info: Struct 'PROPVARIANT' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class PROPVARIANT extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2978:7: Info: Struct 'SAFEARRAY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class SAFEARRAY extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2985:7: Info: Struct 'CLSID' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class CLSID extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2992:7: Info: Struct 'STATSTG' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class STATSTG extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2999:7: Info: Struct 'NLM_SIMULATED_PROFILE_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class NLM_SIMULATED_PROFILE_INFO extends Struct {}
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart:23:7: Info: Struct 'Utf8' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class Utf8 extends Struct {
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf16.dart:16:7: Info: Struct 'Utf16' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class Utf16 extends Struct {
      ^
../../../../software_dev/sdks/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/allocation.dart:47:33: Info: Support for using non-constant type arguments 'T' in this FFI API is deprecated and will be removed in the next stable version of Dart. Rewrite the code to ensure that type arguments are compile time constants referring to a valid native type.
  final int totalSize = count * sizeOf<T>();
                                ^

Is this the issue of the current version of Flutter?

I saw there's a post on StackOverflow regarding the exactly same issue:
https://stackoverflow.com/questions/65912637/how-can-i-fix-this-error-struct-utf8-is-empty-support-for-empty-structs-is-d/65922099

and here's my flutter doctor -v:


flutter doctor

[✓] Flutter (Channel master, 1.26.0-18.0.pre.90, on macOS 11.1 20C69 darwin-x64,
    locale en-US)
    • Flutter version 1.26.0-18.0.pre.90 at
      /Users/benjaminli/software_dev/sdks/flutter
    • Framework revision 25134a16d1 (2 days ago), 2021-01-29 23:52:30 -0800
    • Engine revision ce14c8a841
    • Dart version 2.12.0 (build 2.12.0-276.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/benjaminli/Library/Android/Sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/benjaminli/Library/Android/Sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.52.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.18.1

[✓] Proxy Configuration
    • HTTP_PROXY is set
    • NO_PROXY is localhost,127.0.0.1,LOCALHOST
    • NO_PROXY contains 127.0.0.1
    • NO_PROXY contains localhost

[✓] Connected device (2 available)
    • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86    • Android 11
      (API 30) (emulator)
    • Chrome (web)                • chrome        • web-javascript • Google
      Chrome 88.0.4324.96

• No issues found!

upgrade latest version flutter error:
../../../.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.19.2+1/lib/src/picture_provider.dart:57:59: Error: No named parameter with the name 'nullOk'.
context != null ? Localizations.localeOf(context, nullOk: true) : null,
^^^^^^
../../../Development/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) {
^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1111:7: Info: Struct 'ENUMLOGFONTEX' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class ENUMLOGFONTEX extends Struct {
^
../../../.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2835:7: Info: Struct 'BLUETOOTH_PIN_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class BLUETOOTH_PIN_INFO extends Struct {
^
../../../.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2960:7: Info: Struct 'EXCEPINFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class EXCEPINFO extends Struct {}
^
../../../.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2966:7: Info: Struct 'PROPERTYKEY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class PROPERTYKEY extends Struct {}
^
../../../.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2973:7: Info: Struct 'PROPVARIANT' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class PROPVARIANT extends Struct {}
^
../../../.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2978:7: Info: Struct 'SAFEARRAY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class SAFEARRAY extends Struct {}
^
../../../.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2985:7: Info: Struct 'CLSID' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class CLSID extends Struct {}
^
../../../.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2992:7: Info: Struct 'STATSTG' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class STATSTG extends Struct {}
^
../../../.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2999:7: Info: Struct 'NLM_SIMULATED_PROFILE_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class NLM_SIMULATED_PROFILE_INFO extends Struct {}
^
../../../.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart:23:7: Info: Struct 'Utf8' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class Utf8 extends Struct {
^
../../../.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf16.dart:16:7: Info: Struct 'Utf16' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class Utf16 extends Struct {
^
../../../.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/allocation.dart:47:33: Info: Support for using non-constant type arguments 'T' in this FFI API is deprecated and will be removed in the next stable version of Dart. Rewrite the code to ensure that type arguments are compile time constants referring to a valid native type.
final int totalSize = count * sizeOf();

I have same issue , it's all with Flutter last version
Just downgrade and make sure you are on the Stable channel version not beta
and Use version 19.0 not null safty

flutter channel stable

EDIT: Ok I see so if you downgrade the error related to svg gets fixed but that other error was a deprecated property in clean_settings package. I'm gonna send a PR there.

Trying to update to ^0.20.0-nullsafety.3 but hit the wall because of path_drawing version conflict with fl_chart.
I guess we're going back to from Flutter beta to stable...

Trying to update to ^0.20.0-nullsafety.3 but hit the wall because of path_drawing version conflict with flutter_svg.
I guess we're going back to from Flutter beta to stable...

I'm having the same problem but I need Flutter beta since I'm building for web, it's not available in stable channel. I circumvented this with dependency_overrides in pubspec.yaml, e.g.:

dependency_overrides:
  path_drawing: ^0.5.0-nullsafety.0

You may need more overrides and/or other versions depending on your dependencies. Note that overrides aren't ideal so reverting to stable channel is probably the safer alternative.

@mikeesouth Just edited my comment, the conflict is with fl_chart. Perhaps a general temporary solution is to revert to the Flutter stable (where flutter_svg doesn't error) and then wait... :/

Issue still persists in latest beta - 1.26.0-17.6.pre

Launching lib\main.dart on SM J730G in debug mode...
lib\main.dart:1
/C:/Users/Iqmal/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_svg-0.19.2+1/lib/src/picture_provider.dart:57:59: Error: No named parameter with the name 'nullOk'.
        context != null ? Localizations.localeOf(context, nullOk: true) : null,
                                                          ^^^^^^
/C:/Users/Iqmal/fvm/versions/beta/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
  static Locale localeOf(BuildContext context) {
                ^^^^^^^^
2

FAILURE: Build failed with an exception.

@dnfield I'm not sure I have this right: is it the case that to use this package on dev channel (using it for a desktop app) I need to use the preview version 0.20.0-nullsafety.3 of flutter_svg but then I need to migrate to my app to null-safety as well?

@maks that is probably right (I didn't double check the versions, but sure).

You can use nullsafe libraries without opting into nullsafety. Just like package:flutter is null safe on the dev channel, even if your app is not.

Someone left a comment here saying that this is causing problems, but now the comment seems to be gone.

If anyone is having issues with using the null safe flutter_svg from a non-migrated project, please try to post a sample project that reproduces the issue. AFAIK, it should be perfectly fine to use nullsafe packages from non-migrated code. You just won't get the benefits of null safety in your application when you do that, but it should still basically work.

@dnfield I faced this issue as well, the question here is if this is now fixed on 0.20xxxx why pub.dev is still recommending 0.19.xxx as the stable version?

I probably run into this problem because of this confusion. pub.dev should recommend people to the most stable version not a version with a critical bug.

@dnfield Would it be possible to make a new version 0.19.2+2 and replace on line 57 in /lib/src/picture_provider.dart
Localizations.localeOf(context, nullOk: true), with Localizations.maybeLocaleOf(context)

I changed it in my cached files and it fixed the problem.

Someone left a comment here saying that this is causing problems, but now the comment seems to be gone.

If anyone is having issues with using the null safe flutter_svg from a non-migrated project, please try to post a sample project that reproduces the issue. AFAIK, it should be perfectly fine to use nullsafe packages from non-migrated code. You just won't get the benefits of null safety in your application when you do that, but it should still basically work.

That was me. I offered to make a PR to bring 0.19.x to work with NNBD flutter SDK. However, I was able to get 0.20.x to work by bringing packages that had conflicting dependencies into the project, so I removed the message. Mostly because I think there is value in moderate pressure for packages to migrate to NNBD packages. And I don't have a lot of faith that those small packages are going to migrate anytime soon, so I wanted to lock down the implementation within the project itself.

In our case we were having conflicts with dotted_border

@dnfield Would it be possible to make a new version 0.19.2+2 and replace on line 57 in /lib/src/picture_provider.dart
Localizations.localeOf(context, nullOk: true), with Localizations.maybeLocaleOf(context)

I changed it in my cached files and it fixed the problem.

I tried literally everything and to think I removed the Fluttter SVG package in the problem but still faced the project. This is the only solution that worked, thank you.

I would strongly discourage you from modifying your pub cache. You'll run into strange failures on CI or other development machines. Pub also has no way to repair or track this change.

The _right_ solution is to find an appropriate set of package constraints so that you can use the version of flutter_svg with the flutter SDK you actually have.

And I'd really like to avoid back-publishing fixes if I can. It complicates things and makes more work for me and I'm not even convinced (based on the number of issues I get related to this kind of problem) that it would actually help developers.

All I'm going to say is I took special care to release a non-null-safe version of Fluro that resolved the nullOk issues before I started working on null-safety because I knew it was going to catch a lot of people off guard. There are a lot of projects that have too many non-null-safe dependencies that will not be migrating, but will have to stay up to date with Flutter SDK.

What you do with your package is up to you.

This is killing us over here... we can't go to 2.0 cause it sets off a cascade of dependency hell. Because flutter_svg is so widely depended on this breaks a bunch of other plugins downstream.

I guess we'll just fork it, and remove one parameter, so we can build on master.

It should be considered that the community is currently in a very major transition period, and sharp corners like this are very frustrating and are often compounded by related issues making them hard to unravel. Especially in foundational libraries like this.

Just by way of example, under very tight deadlines, we need to make a spike to test if using SVG is a potential solution to our problem. Can't take more than 5m to test right? That was 2hrs ago, and we're just trying to run a UI spike :(

For my friends in the trenches:

flutter_svg:
    git:
      url: git://github.com/gskinnerTeam/flutter_svg.git
      ref: 12b55b464d2e253f411a17798527a7daa2c00ceb

https://github.com/gskinnerTeam/flutter_svg/tree/nnbd-fix

puts less pressure on the ecosystem to migrate to nullsafety :)

Not sure this is the right way to look at it. Putting pressure on package developers makes sense, packages are existing, and there is no immediate timeline attached to them. Putting pressure on developers writing apps in production, by complicating their lives when they are likely just trying to get some fix out of master, does not really seem like a very considerate thing to do.

Personally I think @esDotDev has a perfectly fair assessment of the situation. This is exactly why I made sure Fluro had a non-null-safe minor version that worked on the stable null-safe SDK. The good news for us was that it was a one liner.

For my friends in the trenches:

flutter_svg:
    git:
      url: git://github.com/gskinnerTeam/flutter_svg.git
      ref: 12b55b464d2e253f411a17798527a7daa2c00ceb

https://github.com/gskinnerTeam/flutter_svg/tree/nnbd-fix

Thx for the quick temp fix :)

I certainly don't want to create problems for app developers. I really think the better way to handle this is via dependency_overrides, but I've published what should be a fix as v0.19.3. I've also pushed that up to the v19 branch on this repo.

Thanks Dan! The issue with overrides (other than them being very mentally draining / slow to sift through) is you can still get stuck in a deadlock.

Currently the biggest issue seems to be CachedNetworkImage, that does not seem to have an nnbd lib, and relies on FlutterCacheManager, which relies on all the usual suspects like PathProvider, SharedPreferences etc. Trying to up anything to 2.0, tends to lead us on a fairly long cascade of overrides, but eventually ending with a conflict between CNP, FlutterCacheManager and everything else.

In our project we used BitDojo, which up-ed his SVG version to 2.0 in order to run on master, which then made him up to 2.0 on all his deps, which then cascaded back to all our libs, and eventually ended in a deadlock. It was all very hard to unravel since we weren't even using SVG directly.

But that just my experience, I'm sure there are myriad of these edge cases lurking around.

You can see the issue here and the eventual fix was actually just to remove SVG entirely from the lib (simplest approach)
https://github.com/bitsdojo/bitsdojo_window/issues/30

Because shared_preferences_windows >=0.0.3-nullsafety <2.0.0 depends on shared_preferences_platform_interface ^2.0.0-nullsafety and shared_preferences 0.5.12+4 depends on shared_preferences_platform_interface ^1.0.0, shared_preferences_windows >=0.0.3-nullsafety <2.0.0 is incompatible with shared_preferences 0.5.12+4.

And because shared_preferences 0.5.12+4 depends on shared_preferences_windows ^0.0.1, shared_preferences 0.5.12+4 requires shared_preferences_windows >=0.0.1 <0.0.3-nullsafety.

And because bitsdojo_window >=0.0.6 is incompatible with shared_preferences_windows <0.0.3-nullsafety (1), bitsdojo_window >=0.0.6 is incompatible with shared_preferences 0.5.12+4.

And because no versions of shared_preferences match >0.5.12+4 <0.6.0, bitsdojo_window >=0.0.6 is incompatible with shared_preferences ^0.5.12+4.

So, because bodega_flutter depends on both shared_preferences ^0.5.12+4 and bitsdojo_window ^0.0.6, version solving failed.

Not fun ^

Was this page helpful?
0 / 5 - 0 ratings

Related issues

boanergepro picture boanergepro  Â·  5Comments

coupestartup picture coupestartup  Â·  6Comments

jeffersondarcy picture jeffersondarcy  Â·  3Comments

alectogeek picture alectogeek  Â·  5Comments

lennartschoch picture lennartschoch  Â·  4Comments