getFrame method
Implementation
Rect? getFrame(int? frame) {
// Given a frame index, return the rect that describes that frame in the image.
if (image == null || frame == null || frame < 0 || frame >= length) {
return null;
}
int i = frame * 4;
return Rect.fromLTRB(
positions[i], positions[i + 1], positions[i + 2], positions[i + 3]);
}