getIOSATTAuth method Null safety

Future<IOSATTAuthResult> getIOSATTAuth()

get iOS App Tracking Authentication status, returns IOSATTAuthResult enum

Implementation

Future<IOSATTAuthResult> getIOSATTAuth() async {
  if (Platform.isIOS) {
    final String? result = await _channel.invokeMethod("getATT");
    switch (result) {
      case "NotDetermined":
        return IOSATTAuthResult.notDetermined;

      case "Restricted":
        return IOSATTAuthResult.restricted;

      case "Denied":
        return IOSATTAuthResult.denied;

      case "Authorized":
        return IOSATTAuthResult.authorized;

      case "NOT":
        return IOSATTAuthResult.iOSVersionNotSupported;

      default:
        return IOSATTAuthResult.none;

    }
  } else {
    return IOSATTAuthResult.android;
  }
}