Open tnaseem opened 2 years ago
LateInitializationError
flutter sdk 2.5.1
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Exception: LateInitializationError: Field '_paint@268459774' has not been initialized.
#0 FlutterActorImage._paint (package:flare_flutter/flare.dart)
#1 FlutterActorImage.onBlendModeChanged (package:flare_flutter/flare.dart:505:5)
#2 FlutterActorDrawable.blendMode= (package:flare_flutter/flare.dart:226:5)
#3 FlutterActorDrawable.blendModeId= (package:flare_flutter/flare.dart:234:5)
#4 ActorDrawable.read (package:flare_flutter/base/actor_drawable.dart:77:17)
#5 ActorImage.read (package:flare_flutter/base/actor_image.dart:305:19)
#6 ActorArtboard.readComponentsBlock (package:flare_flutter/base/actor_artboard.dart:387:34)
#7 ActorArtboard.read (package:flare_flutter/base/actor_artboard.dart:349:11)
onBlendModeChanged
Function, _paint
never initialized when ActorDrawable read -> set blendModeId
,but _paint
sound late ui.Paint
@override
void onBlendModeChanged(ui.BlendMode mode) {
_paint.blendMode = mode;
onPaintUpdated(_paint);
}
I'm having the same issue as @azhansy here on this closed issue.
I've just updated my app from Flutter 1.x.x to 2.x.x and using flare_flutter 3.0.2.
Everything was working fine under Flutter 1.x.x, but since upgrading my code to work with 2.2.3, this is the only problem I'm experiencing in my app. The error output is:
I created a helper class for my Flare/Rive animations as below:
Basically, on initialisation, I cache the flare assets so they're all ready to be animated. Then call the
play()
function to run the animation.This all used to work beautifully in the past. Now, with Flutter 2.x I'm getting the above error (even if I don't cache the files and attempt to play the files directly). It appears to be that
_paint
is not getting initialised inflare.dart
.Any pointers/help are most appreciated!