decode function

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

Implementation

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

  return DecodeData(
    data: Uint8List.fromList(rgbaData.cast<int>()),
    durations: Uint32List.fromList(durations.cast<int>()),
    width: decoded.getProperty('width'.toJS) as int,
    height: decoded.getProperty('height'.toJS) as int,
  );
}