receiveFutureResult<R> function

Future<R> receiveFutureResult<R>(
  1. List<Object?> response
)

Converts a received message created by sendFutureResult to a future result.

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

Implementation

Future<R> receiveFutureResult<R>(List<Object?> response) {
  if (response.length == 2) {
    var error = RemoteError(response[0] as String, response[1] as String);
    return Future.error(error, error.stackTrace);
  }
  var result = response[0] as R;
  return Future<R>.value(result);
}