Flare-Flutter icon indicating copy to clipboard operation
Flare-Flutter copied to clipboard

type 'FlutterColorFill' is not a subtype of type 'ActorNode' in type cast

Open ljsalvatierra opened this issue 6 years ago • 8 comments

Hi, first I would like to thank you for this amazing project, truly amazing :)

I/flutter (10799): ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (10799): The following _CastError was thrown during a scheduler callback:
I/flutter (10799): type 'FlutterColorFill' is not a subtype of type 'ActorNode' in type cast
I/flutter (10799): 
I/flutter (10799): When the exception was thrown, this was the stack:
I/flutter (10799): #0      KeyFrameOpacity.setValue (package:flare_dart/animation/keyframe.dart:371:32)
I/flutter (10799): #1      KeyFrameNumeric.applyInterpolation (package:flare_dart/animation/keyframe.dart:134:5)
I/flutter (10799): #2      PropertyAnimation.apply (package:flare_dart/animation/actor_animation.dart:207:21)
I/flutter (10799): #3      ComponentAnimation.apply (package:flare_dart/animation/actor_animation.dart:248:27)
I/flutter (10799): #4      ActorAnimation.apply (package:flare_dart/animation/actor_animation.dart:403:26)
I/flutter (10799): #5      FlareActorRenderObject.beginFrame (package:flare_flutter/flare_actor.dart:328:23)
I/flutter (10799): #6      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:988:15)
I/flutter (10799): #7      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:904:11)
I/flutter (10799): #8      __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection/runtime/libcompact_hash.dart:367:8)
I/flutter (10799): #9      _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleBeginFrame (package:flutter/src/scheduler/binding.dart:902:17)
I/flutter (10799): #10     _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleBeginFrame (package:flutter/src/scheduler/binding.dart:832:5)
I/flutter (10799): #14     _invoke1 (dart:ui/hooks.dart:223:10)
I/flutter (10799): #15     _beginFrame (dart:ui/hooks.dart:162:3)
I/flutter (10799): (elided 3 frames from package dart:async)

It happens when i try to transform the visibility of a FlareActor. I set the percent visible with a gesture detector.

          Transform(
            transform: new Matrix4.translationValues(
                0.0, 50.0 * (1.0 - widget.percentVisible), 0.0),
            child: new Padding(
              padding: new EdgeInsets.only(top: 20.0, bottom: 10.0),
              child: FlareActor(
                "assets/animation.flr",
                alignment: Alignment.center,
                fit: BoxFit.contain,
                animation: 'idle',
              ),
            ),
          )

Kind regards, Luis

ljsalvatierra avatar Feb 19 '19 20:02 ljsalvatierra

Hey @ljsalvatierra, thanks for the error report! Could you share the affected Flare file?

umberto-sonnino avatar Mar 12 '19 16:03 umberto-sonnino

I am also getting a similar issue. Is there any update on this?

jasonch99 avatar Sep 18 '20 02:09 jasonch99

The case that @jasonch99 is talking about is difficult to reproduce consistently.

This assignment should just never happen though, unless the class heirarchy is re-worked. FlutterFillColor inherits from FrareComponent, which is a superclass of FlareActor.

An "easy" fix would be to make it a descendent of FlareActor, but I don't know if that's correct.

dnfield avatar Sep 18 '20 03:09 dnfield

Hi @dnfield and @jasonch99 - Let me check in on this today for both of you with engineering. -Kelly (Rive CS)

kekecorp avatar Sep 18 '20 16:09 kekecorp

@kekecorp, any update on this?

jasonch99 avatar Sep 21 '20 21:09 jasonch99

We are seeing similar stack traces in other apps as well:

error: type 'FlutterActorShape' is not a subtype of type 'ActorPath' in type cast
#0      KeyFramePathVertices.applyInterpolation (package:flare_dart/animation/keyframe.dart:683)
#1      PropertyAnimation.apply (package:flare_dart/animation/actor_animation.dart:215)
#2      ComponentAnimation.apply (package:flare_dart/animation/actor_animation.dart:257)
#3      ActorAnimation.apply (package:flare_dart/animation/actor_animation.dart:411)
#4      FlareControls.advance (package:flare_flutter/flare_controls.dart:85)
#5      FlareActorRenderObject.advance (package:flare_flutter/flare_actor.dart:474)
#6      FlareActorRenderObject._instanceArtboard (package:flare_flutter/flare_actor.dart:380)
#7      FlareActorRenderObject.coldLoad (package:flare_flutter/flare_actor.dart:411)
type 'FlutterActorEllipse' is not a subtype of type 'ActorPath' in type cast
at KeyFramePathVertices.apply   (keyframe.dart:663)
at PropertyAnimation.apply      (actor_animation.dart:207)
at ComponentAnimation.apply     (actor_animation.dart:257)
at ActorAnimation.apply (actor_animation.dart:411)
at FlareControls.advance        (flare_controls.dart:85)
at FlareActorRenderObject.advance       (flare_actor.dart:474)
at FlareRenderBox._beginFrame   (flare_render_box.dart:121)

@luigi-rosso any idea under what conditions these would appear?

mehmetf avatar Oct 13 '20 04:10 mehmetf

This could happen if an animation is being applied to an artboard that it wasn't created for.

FlareActor usually takes care of maintaining valid animations for the active artboard. However, when using a custom controller it's possible for the controlling widget to change the file being displayed and not change the controller in tandem. The controller could still be applied with the wrong animation. In Rive 2 we change this around a bit by making the controller's lifecycle being tied to the artboard instead of the rendering widget, making it difficult for someone to accidentally run into this condition.

The important thing for is to make sure custom controllers are removed from the rendering widget when the file changes (change filename/artboard reference and controller in sync).

luigi-rosso avatar Oct 13 '20 04:10 luigi-rosso

Thanks for the clarification. I will try using a new FlareControls whenever the file is changed.

jasonch99 avatar Oct 13 '20 05:10 jasonch99