decodeAnimation method Null safety

  1. @override
Animation? decodeAnimation(
  1. List<int> bytes
)
override

Decode all of the frames from an animation. If the file is not an animation, a single frame animation is returned. If there was a problem decoding the file, null is returned.

Implementation

@override
Animation? decodeAnimation(List<int> bytes) {
  final image = decodeImage(bytes);
  if (image == null) {
    return null;
  }

  final anim = Animation();
  anim.width = image.width;
  anim.height = image.height;
  anim.addFrame(image);

  return anim;
}