3

I am trying to get Flare animation working in Flutter. For this, I tried this : https://github.com/tarek360/Boring-Star-Animation

Actually, that code is working perfectly fine. But, I wanted to change the animation to this : https://www.2dimensions.com/a/innocent/files/flare/status_success

Now, the code runs and the animation is showed, but is still. (i.e., not animating, only the photo is displayed) And I get below error:

E/flutter ( 7462): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method '*' was called on null.
E/flutter ( 7462): Receiver: null
E/flutter ( 7462): Tried calling: *(0.0)
E/flutter ( 7462): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
E/flutter ( 7462): #1      KeyFrameStrokeEnd.setValue (package:flare_dart/animation/keyframe.dart:1161:33)
E/flutter ( 7462): #2      KeyFrameNumeric.apply (package:flare_dart/animation/keyframe.dart:138:5)
E/flutter ( 7462): #3      PropertyAnimation.apply (package:flare_dart/animation/actor_animation.dart:199:21)
E/flutter ( 7462): #4      ComponentAnimation.apply (package:flare_dart/animation/actor_animation.dart:248:27)
E/flutter ( 7462): #5      ActorAnimation.apply (package:flare_dart/animation/actor_animation.dart:403:26)
E/flutter ( 7462): #6      FlareActorRenderObject._updateAnimation (package:flare_flutter/flare_actor.dart:468:19)
E/flutter ( 7462): #7      FlareActorRenderObject.filename=.<anonymous closure> (package:flare_flutter/flare_actor.dart:245:11)
E/flutter ( 7462): #8      _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter ( 7462): #9      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 7462): #10     _FutureListener.handleValue (dart:async/future_impl.dart:126:18)
E/flutter ( 7462): #11     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45)
E/flutter ( 7462): #12     Future._propagateToListeners (dart:async/future_impl.dart:668:32)
E/flutter ( 7462): #13     Future._complete (dart:async/future_impl.dart:473:7)
E/flutter ( 7462): #14     _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
E/flutter ( 7462): #15     _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20)
E/flutter ( 7462): #16     _rootRun (dart:async/zone.dart:1120:38)
E/flutter ( 7462): #17     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 7462): #18     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 7462): #19     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 7462): #20     _rootRun (dart:async/zone.dart:1124:13)
E/flutter ( 7462): #21     _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 7462): #22     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 7462): #23     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 7462): #24     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 7462): #25     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter ( 7462): 

I am very much sure that I did not mistype the filename and animation name.

Below is my main.dart file:

import 'package:flutter/material.dart';
import "package:flare_flutter/flare_actor.dart";

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'The Boring Star',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return new FlareActor("animations/status_success.flr",
        alignment: Alignment.center,
        fit: BoxFit.contain,
        animation: "success_arrow");
  }
}

-----EDIT------- I don't know why, but below animation is working very nicely https://www.2dimensions.com/a/pollux/files/flare/smiley-switch

So, it concludes that there is some problem with my animation : https://www.2dimensions.com/a/innocent/files/flare/status_success

Can anyone help me with this?

Ravi Kavaiya
  • 205
  • 2
  • 10

3 Answers3

2

The name of the animation is not success_arrow but just success

FlareActor("animations/status_success.flr",
        alignment: Alignment.center,
        fit: BoxFit.contain,
        animation: "success");
Krishna
  • 239
  • 2
  • 11
1

If the animation name is not changed then animation: will be "Untitled"

Firosh Vasudevan
  • 671
  • 10
  • 11
-1

Change the name of the animation to the same name of animation in your web project.