shouldRemove property

  1. @override
bool shouldRemove
override

Component will be removed after animation is done and removeOnFinish is set.

Note: SpriteAnimationComponent will not be removed automatically if loop property of SpriteAnimation is true.

Implementation

@override
bool get shouldRemove =>
    super.shouldRemove || (removeOnFinish && (animation?.done() ?? false));
void shouldRemove=(bool _shouldRemove)
inherited

Whether this component should be removed or not.

It will be checked once per component per tick, and if it is true, FlameGame will remove it.

Implementation

bool shouldRemove = false;