stop method

FutureOr<bool> stop()

Stops the APIRoot instance. Calls _stopper if needed. Will return false if is not already started (see isStarted and start).

Implementation

FutureOr<bool> stop() {
  if (!isStarted) return false;

  var stopped = _stopped;
  if (stopped != null) {
    if (stopped) return true;
    throw StateError("Already stopping");
  }

  _stopped = false;

  var apiRoot = _apiRoot;
  if (apiRoot != null) {
    return apiRoot.close().resolveMapped((val) {
      return _stopImpl();
    });
  }

  return _stopImpl();
}