checkServiceStatus method

Future<ServiceStatus> checkServiceStatus(
  1. Permission permission
)

Checks the current status of the service associated with the given Permission.

Implementation

Future<ServiceStatus> checkServiceStatus(Permission permission) async {
  try {
    final permissionStatus = await checkPermissionStatus(permission);
    switch (permissionStatus) {
      case PermissionStatus.granted:
        return ServiceStatus.enabled;
      default:
        return ServiceStatus.disabled;
    }
  } on UnimplementedError {
    rethrow;
  }
}