2d-inc / Flare-Flutter

Load and get full control of your Rive files in a Flutter project using this library.
https://rive.app/
MIT License
2.55k stars 469 forks source link

Latest version 1.7.0 not compiling using Flutter stable channel #187

Closed gabrielginter closed 4 years ago

gabrielginter commented 4 years ago

When using latest version of flare_flutter 1.7.0 user will get the following error if they use the Flutter stable channel when compiling.

Compiler message:
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flare_flutter-1.7.0/lib/flare.dart:1109:11: Error: No named parameter with the name 'cacheWidth'.
          cacheWidth: cacheWidth, cacheHeight: cacheHeight);
          ^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flare_flutter-1.7.0/lib/flare.dart:1106:33: Error: Too many positional arguments: 1 allowed, but 2 found.
Try removing the extra positional arguments.
    var load = networkImage.load(val, (Uint8List bytes,
                                ^
Compiler failed on ......

Line 1108 in file /lib/flare.dart tries to call method PaintingBinding.instance.instantiateImageCodec with parameters "cacheWidth" and "cacheHeight", such parameters in PaintingBinding haven't been added yet to the stable flutter release.

The following commit to Flutter has the changes I just mentioned: Commit d28651d

Perhaps this was intentional, but it will catch many users by surprise. If we are supposed to use a different flutter channel with version 1.7.0, perhaps would be good to add this to the change log in flutter.dev

Cheers

luigi-rosso commented 4 years ago

Thanks for the note, we just published 1.7.1 to fix this issue!

If you need changeImageFromNetwork, here's an example implemented as an extension method: https://gist.github.com/luigi-rosso/c50277341bd2681be072a575acbeb1fc#file-dynamic_image_swapping-dart-L100

This was implemented for issue #183

gabrielginter commented 4 years ago

wow that was fast!! thanks!!