onTakeLocalSnapshotResult method

void onTakeLocalSnapshotResult(
  1. dynamic taskId,
  2. int width,
  3. int height,
  4. String filePath,
  5. int error,
)

Implementation

void onTakeLocalSnapshotResult(
  dynamic taskId,
  int width,
  int height,
  String filePath,
  int error,
) {
  var completer = _localCompleters.remove(taskId.toString());
  debugPrint(_localCompleters.toString());
  if (completer == null) {
    debugPrint('Completer<LocalSnapshot> not found!');
    return;
  }
  if (completer.isCompleted || completer.isCanceled) {
    debugPrint('Completer<LocalSnapshot> is consumed!');
    return;
  }
  if (error == 0) {
    completer.complete(
      LocalSnapshot(
        taskId: int.tryParse(taskId.toString()) ?? 0,
        filePath: filePath,
        width: width,
        height: height,
      ),
    );
  } else {
    completer.completeError(error);
  }
}