takeSnapShot method Null safety

Future<Uint8List> takeSnapShot()

Take snapshot (screen shot) of current playing video

If you want to use takeSnapshot, you must call player.setOption(FijkOption.hostCategory, "enable-snapshot", 1); after you create a FijkPlayer. Or else this method returns error.

Example:

var imageData = await player.takeSnapShot();
var provider = MemoryImage(v);
Widget image = Image(image: provider)

Implementation

Future<Uint8List> takeSnapShot() async {
  await _nativeSetup.future;
  FijkLog.i("$this takeSnapShot");
  var snapShot = _snapShot;
  if (snapShot != null && !snapShot.isCompleted) {
    return Future.error(StateError("last snapShot is not finished"));
  }
  snapShot = Completer<Uint8List>();
  _snapShot = snapShot;
  _channel.invokeMethod("snapshot");
  return snapShot.future;
}