Flutter_svg: Exception caught by SVG: tried to call a non-function, such as null: 'this.function._equals'

Created on 17 Apr 2021  ยท  19Comments  ยท  Source: dnfield/flutter_svg

โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by SVG โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
The following JSNoSuchMethodError was thrown resolving a single-frame picture stream:
NoSuchMethodError: tried to call a non-function, such as null: 'this.function._equals'

packages/petitparser/src/definition/reference.dart 19:11                          _equals
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 687:60  equals
dart-sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart 147:17         _get
packages/petitparser/src/definition/grammar.dart 138:27                           _dereference
packages/petitparser/src/definition/grammar.dart 163:30                           [_resolve]
...
Picture provider: ExactAssetPicture(name: "res/icons/plus.svg", bundle: null, colorFilter: null)
Picture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#526cb(), name: "res/icons/plus.svg", colorFilter: null)

โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by SVG โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
NoSuchMethodError: tried to call a non-function, such as null: 'this.function._equals'
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by SVG โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
NoSuchMethodError: tried to call a non-function, such as null: 'this.function._equals'
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

everything was working just a 2 days ago , after i updated flutter and pubspec.yaml , all svgs' in my app are not working they show nothing,

Most helpful comment

Filed https://github.com/dart-lang/sdk/issues/45762, closing this issue in favor of that one.

All 19 comments

Can you share an SVG and pubspec that recreates this? Or perhaps an entire project?

It'd be helpful to note which version of Flutter as well (which commit).

https://github.com/phaylali/albourane/tree/master/admin

I SHOULD NOTE THAT THE PROBLEM HAPPENS ON FLUTTER WEB, LATEST DEV CHANNEL

if it didn't work just make a firebase-config.js in the web folder and put some dummy project credentials there

in the HomePage you'll find a "MainBody" widget which had a custom drawer, i made a class called OmniIcons to put the svgs there , put i also tried it directly and it didn't work

Flutter is already up to date on channel dev
Flutter 2.2.0-10.1.pre โ€ข channel dev โ€ข https://github.com/flutter/flutter.git
Framework โ€ข revision 0941968447 (3 days ago) โ€ข 2021-04-15 12:01:02 -0700
Engine โ€ข revision d2a2e93510
Tools โ€ข Dart 2.13.0 (build 2.13.0-211.6.beta)

i tried it on flutter stable , and it's working fine on the web, i'm closing this issue for now , but there might be some issue in the future releases that may break all packages depending on svg

I don't think this issue should be closed. I am seeing the same issue on the Flutter beta channel. It affects all SVGs in my web project. It seems very likely that this will be a major issue in the next Flutter stable release.

@dnfield
https://github.com/doppio/svg_error_example Here is a very simple example project that just displays a simple icon SVG.

When you run it web using the latest Flutter beta (v2.2.0-10.1.pre, commit 0941968), you'll see that no image is displayed and the exception reported by @phaylali is printed to the console. The project works as expected on the stable channel (v2.0.5, commit adc6878) as well as the _previous_ beta release (v2.1.0-12.2.pre, commit 5bedb7b).

@dnfield
https://github.com/doppio/svg_error_example Here is a very simple example project that just displays a simple icon SVG.

When you run it web using the latest Flutter beta (v2.2.0-10.1.pre, commit 0941968), you'll see that no image is displayed and the exception reported by @phaylali is printed to the console. The project works as expected on the stable channel (v2.0.5, commit adc6878) as well as the _previous_ beta release (v2.1.0-12.2.pre, commit 5bedb7b).

Yeah, that's why the developer must investigate what's causing that, because if what causing that got merged in the stable channel, the package and all packages depending on it will break (yes i tried other packages that depend on this one and they didn't work) having it work on stable, is more of a temporary workaround rather than a solution,

In that case, would you mind re-opening the issue @phaylali?

I'm able to reproduce this easily with the example SVG app in this repo.

This seems like abug in DDC.

This is a bug in ddc.

Minimal repro:

void main() {
  Function f1 = () { print('f1'); };
  Function f2 = () { print('f2'); };

  print(f1 == f2);
}

You'll find it works in profile or release mode, but not debug mode, because of DDC.

Filed https://github.com/dart-lang/sdk/issues/45762, closing this issue in favor of that one.

@dnfield I poked around the issues and they all appear to claim that the issue above was resolved by a cherry picked commit on beta... but we're getting this issue on dev. any visibility on this being fixed in dev?

Flutter 2.2.0-10.1.pre โ€ข channel dev โ€ข https://github.com/flutter/flutter.git
Framework โ€ข revision 0941968447 (11 days ago) โ€ข 2021-04-15 12:01:02 -0700
Engine โ€ข revision d2a2e93510
Tools โ€ข Dart 2.13.0 (build 2.13.0-211.6.beta)
โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by SVG โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
NoSuchMethodError: tried to call a non-function, such as null: 'this.function._equals'
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by SVG โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
NoSuchMethodError: tried to call a non-function, such as null: 'this.function._equals'
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by SVG โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
NoSuchMethodError: tried to call a non-function, such as null: 'this.function._equals'

@dnfield I'm trying to get visibility on where this fix is in relation to the dev flutter/flutter channel. I haven't been able to find a way to really understand where the cherry pick is. Our team is currently unable to run the app on web in dev mode which is blocking one of our developes so I'm trying to find some relief.

Just got the same issue, is there a workaround meanwhile?

Flutter's latest beta channel has the fix for this.

Flutter's latest beta channel has the fix for this.

On the master channel I still have the issue, so that's pretty strange

It's been cherry picked into beta specifically.

AFAIK, it should also be fixed on master though... Are you sure you're up to date with the latest revision?

Are you sure you're up to date with the latest revision?

Pretty sure!


Flutter doctor output

Doctor summary (to see all details, run flutter doctor -v):
[โœ“] Flutter (Channel master, 2.3.0-1.0.pre.181, on macOS 11.3 20E232 darwin-x64, locale en-GB)
[โœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[โœ“] Xcode - develop for iOS and macOS
[โœ“] Chrome - develop for the web
[โœ“] Android Studio (version 4.1)
[โœ“] VS Code (version 1.55.2)
[โœ“] Connected device (2 available)
    ! Error: iPhone is not connected. Xcode will continue when iPhone is connected. (code -13)

โ€ข No issues found!

This is resolved on dev channel FWIW

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChristianKleineidam picture ChristianKleineidam  ยท  5Comments

alectogeek picture alectogeek  ยท  5Comments

jeffersondarcy picture jeffersondarcy  ยท  3Comments

kentcb picture kentcb  ยท  4Comments

LeandroDoldan picture LeandroDoldan  ยท  3Comments