resetDecoder method

  1. @override
Future<bool> resetDecoder({
  1. required String key,
})
override

Implementation

@override
Future<bool> resetDecoder({required String key}) {
  final request = KeyRequest(
    key: key,
    data: Uint8List.fromList([1]),
  ).writeToBuffer();
  final nativeRequest = toPointer(request);

  final completer = Completer<bool>();
  final port = RawReceivePort();
  port.handler = (response) {
    port.close();

    completer.complete(response);
  };

  flutterAvifFFI.reset_decoder(
    port.sendPort.nativePort,
    nativeRequest[0],
    nativeRequest[1],
  );

  malloc.free(nativeRequest[0]);

  return completer.future;
}