decode function

Future<DecodeData> decode(
  1. Uint8List data,
  2. int orientation
)

Implementation

Future<DecodeData> decode(Uint8List data, int orientation) async {
  final JSObject decoded = await _decode(data.toJS, orientation.toJS).toDart;
  final rgbaData = decoded.getProperty('data'.toJS) as JSArray<JSNumber>;
  final durations = decoded.getProperty('durations'.toJS) as JSArray<JSNumber>;

  return DecodeData(
    data: Uint8List.fromList(rgbaData.toDart.map((e) => e.toDartInt).toList()),
    durations: Uint32List.fromList(durations.toDart.map((e) => e.toDartInt).toList()),
    width: (decoded.getProperty('width'.toJS) as JSNumber).toDartInt,
    height: (decoded.getProperty('height'.toJS) as JSNumber).toDartInt,
  );
}