decodeAnimation method

  1. @override
Animation? decodeAnimation(
  1. List<int> data
)
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> data) {
  if (!isValidFile(data)) return null;
  final image = decodeImage(data)!;

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

  return anim;
}