decodeAnimation method

  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) {
  if (startDecode(bytes) == null) {
    return null;
  }

  final anim = Animation();
  anim.width = info!.width;
  anim.height = info!.height;
  anim.frameType = FrameType.page;
  for (var i = 0, len = numFrames(); i < len; ++i) {
    final image = decodeFrame(i);
    anim.addFrame(image!);
  }

  return anim;
}