completeFutureResult<R> function

void completeFutureResult<R>(
  1. List<Object?> response,
  2. Completer<R> completer
)

Completes a completer with a message created by sendFutureResult

The response must be a message on the format sent by sendFutureResult.

Implementation

void completeFutureResult<R>(List<Object?> response, Completer<R> completer) {
  if (response.length == 2) {
    var error = RemoteError(response[0] as String, response[1] as String);
    completer.completeError(error, error.stackTrace);
  } else {
    var result = response[0] as R;
    completer.complete(result);
  }
}