rive-app / rive-flutter

Flutter runtime for Rive
https://rive.app
MIT License
1.21k stars 191 forks source link

Documentation out of date regarding creating RiveFile #87

Closed ChristianKleineidam closed 3 years ago

ChristianKleineidam commented 3 years ago

At https://blog.rive.app/rives-flutter-runtime-part-1/ and https://blog.rive.app/pull-to-refresh-flutter/ the Rive documentation suggest to create a RiveFile via calling a default constructor and then loading the content:

final file = RiveFile();

   if (file.import(bytes)) {
     setState(() => _artboard = file.mainArtboard
       ..addController(
         SimpleAnimation('idle'),
       ));
   }

It seems like this changed and now has to be:

final file = RiveFile.import(bytes);

setState(() => _artboard = file.mainArtboard
  ..addController(
    SimpleAnimation('idle'),
  ));
fredgrott commented 3 years ago

yes and the if conditional should be bytes.buffer.isFinite as file.import does not exist!

mjohnsullivan commented 3 years ago

These blog posts are very out of date and we're in the process of updating our dev docs and blog posts. We'll get this corrected shortly.

mjohnsullivan commented 3 years ago

We've updated the examples in the Gtihub repo: https://github.com/rive-app/rive-flutter/tree/master/example

We've also started to flesh out our developer documentation in our help center, which has the latest Flutter docs: https://help.rive.app/runtimes/quick-start#1-add-the-rive-package-dependency

mjohnsullivan commented 3 years ago

Blog post's been rewritten: https://blog.rive.app/rives-flutter-runtime/