complete method

void complete(
  1. OneTapLocationResult result
)

Reports result and ends the request.

Unless grantAccess was called, a OneTapLocationGranted or OneTapLocationFailed result grants access first, so that OneTapLocationController.isLocating turns true before the result is reported, as on a device. On iOS, a failure with OneTapLocationErrorCode.locationServicesDisabled is reported without it, because the system grants no access while location services are turned off.

Throws a StateError if the request was answered.

Implementation

void complete(OneTapLocationResult result) {
  _checkNotAnswered();
  if (_isCancelled) {
    return;
  }
  if (_state == _FakeRequestState.waiting && _grantsAccessBefore(result)) {
    _listener.onLocating();
  }
  _state = _FakeRequestState.answered;
  _listener
    ..onResult(result)
    ..onDone();
}