RawFrame constructor

RawFrame({
  1. required int frameIndex,
  2. required int width,
  3. required int height,
  4. required Uint8List rgba,
})

Creates a frame at frameIndex with widthxheight pixels in rgba.

Throws an ArgumentError when rgba.length != width * height * 4.

Implementation

RawFrame({
  required this.frameIndex,
  required this.width,
  required this.height,
  required this.rgba,
}) {
  final expected = width * height * 4;
  if (rgba.length != expected) {
    throw ArgumentError.value(
      rgba.length,
      'rgba',
      'must hold exactly width*height*4 = $expected bytes for ${width}x$height',
    );
  }
}