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

The argument type 'Int32List' can't be assigned to the parameter type 'Uint16List' #79

Closed vanelizarov closed 5 years ago

vanelizarov commented 5 years ago

Suddenly compiler started showing me this error:

Compiler message:

file:///Users/vanelizarov/flutter/.pub-cache/hosted/pub.dartlang.org/flare_flutter-1.4.0/lib/flare.dart:1028:18: Error: The argument type 'Int32List' can't be assigned to the parameter type 'Uint16List'.
 - 'Int32List' is from 'dart:typed_data'.
 - 'Uint16List' is from 'dart:typed_data'.
Try changing the type of the parameter, or casting the argument to 'Uint16List'.
        indices: _indices, textureCoordinates: _uvBuffer);
                 ^

I'm using only FlareActor class and do it like so:

FlareActor(
  'assets/flare/notifications.flr',
  alignment: Alignment.center,
  animation: count > 0 ? 'pendulum' : null,
  color: Colors.primary,
)

flutter doctor:

[✓] Flutter (Channel dev, v1.5.5, on Mac OS X 10.14.5 18F118d, locale en-RU)
    • Flutter version 1.5.5 at /Users/vanelizarov/flutter
    • Framework revision 5c5ddd1fc2 (19 hours ago), 2019-04-23 10:41:19 -0700
    • Engine revision e27c867c30
    • Dart version 2.3.0 (build 2.3.0-dev.0.1 1f1592edce)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/vanelizarov/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 33.4.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

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

[✓] Connected device (1 available)
    • iPhone Xʀ • D71EC0B3-B4A2-41DB-9C0C-878DCDD474E3 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-2 (simulator)

• No issues found!
umberto-sonnino commented 5 years ago

This is due to some breaking changes on Flutter's master branch. We had to change the type of the list accordingly. You're using Flutter's dev channel, so you can either use Flutter master (from the command line: flutter channel master), or you can change the type of the list yourself on this line, and this assignment with Uint16.fromList(triangles) while we figure out a better fix for this.

vanelizarov commented 5 years ago

@umberto-sonnino cool! Would it be ok if I then submit PR?

umberto-sonnino commented 5 years ago

Hey @vanelizarov, thanks for your contribution, but unfortunately there are some breaking differences between the various Flutter versions, depending on the channel you're using: this means that simply changing those types won't fix the issue, because it'll break for somebody else using a different channel.

@luigi-rosso created ad-hoc branches that support the corresponding Flutter channel.

You can take a look at the updated README to see how this all works!

vprudnikoff commented 5 years ago

This is due to some breaking changes on Flutter's master branch. We had to change the type of the list accordingly. You're using Flutter's dev channel, so you can either use Flutter master (from the command line: flutter channel master), or you can change the type of the list yourself on this line, and this assignment with Uint16.fromList(triangles) while we figure out a better fix for this.

This is due to some breaking changes on Flutter's master branch. We had to change the type of the list accordingly. You're using Flutter's dev channel, so you can either use Flutter master (from the command line: flutter channel master), or you can change the type of the list yourself on this line, and this assignment with Uint16.fromList(triangles) while we figure out a better fix for this.

Hello! I've changed flutter channel to master, but still got the same issue. http://priscree.ru/img/99a80c98010a28.png

umberto-sonnino commented 5 years ago

Hey @prudnikoff, you can take a look at the README for how to set everything up according to the Flutter Channel you want to use! In any case, Flutter stable works with this repo's stable branch

lucasmatoscc commented 5 years ago

Locally changing line 875 to Uint16List _indices; and line 936 to Uint16List.fromList(triangles); temporarily solves the issue and allows you to run the app, even though it may not be the best solution (not familiar with Flare data).

stellarbear commented 5 years ago

True, wanted to make this PR, but already done.

pallavbohara commented 4 years ago

recent beta version of flutter(1.19.0-4.2.pre) is not giving this error.