diff --git a/packages/flame/lib/src/components/sprite_animation_group_component.dart b/packages/flame/lib/src/components/sprite_animation_group_component.dart index 74dd3dd0812..d2fdad28996 100644 --- a/packages/flame/lib/src/components/sprite_animation_group_component.dart +++ b/packages/flame/lib/src/components/sprite_animation_group_component.dart @@ -151,7 +151,11 @@ class SpriteAnimationGroupComponent extends PositionComponent } /// Returns the map of animation state and their corresponding animations. - Map? get animations => _animations; + /// + /// If you want to change the contents of the map use the animations setter + /// and pass in a new map of animations + Map? get animations => + _animations != null ? Map.unmodifiable(_animations!) : null; /// Sets the given [value] as new animation state map. set animations(Map? value) {