execFuture method

void execFuture(
  1. String? id,
  2. int code,
  3. dynamic onOK,
  4. String? errorText,
)

Implementation

void execFuture(String? id, int code, dynamic onOK, String? errorText) {
  var callbacks = _pendingFutures[id];

  if (callbacks != null) {
    _pendingFutures.remove(id);
    if (code >= 200 && code < 400) {
      callbacks.completer?.complete(onOK);
    } else {
      callbacks.completer?.completeError(
        Exception(
          (errorText ?? '') + ' (' + code.toString() + ')',
        ),
      );
    }
  }
}