answerPermissionPrompt method

void answerPermissionPrompt()

Answers the permission flow: applies the next scripted answer.

Implementation

void answerPermissionPrompt() {
  if (access.state == LocationPermissionState.permanentlyDenied ||
      access.state == LocationPermissionState.restricted) {
    return;
  }
  final a = _permissionAnswers.isEmpty
      ? FakeUserResponse.grantPrecise
      : _permissionAnswers.removeFirst();
  access = switch (a) {
    FakeUserResponse.grantPrecise => LocationAccess.grantedPrecise,
    FakeUserResponse.grantApproximate => LocationAccess.grantedApproximate,
    FakeUserResponse.deny => LocationAccess.denied,
    FakeUserResponse.denyPermanently => LocationAccess.permanentlyDenied,
    _ => access,
  };
  _emitStatus();
}