adjust / flutter_sdk

This is the Flutter SDK of
MIT License
56 stars 47 forks source link

App-tracking authorization wrapper example has errors #109

Open b099l3 opened 1 year ago

b099l3 commented 1 year ago

The Example here for App-tracking authorization wrapper has an error where the type num cant be used in the switch case, the error:

The type 'num' is not exhaustively matched by the switch cases since it doesn't match 'double()'. Try adding a default case or cases that match 'double()'.

Suggested changes:

  1. (quick fix) Convert status to int in the example
if (Platform.isIOS) {
  Adjust.requestTrackingAuthorizationWithCompletionHandler().then((statusNum) {
    final status = statusNum.toInt();
    switch (status) {
      case 0:
        // ATTrackingManagerAuthorizationStatusNotDetermined case
        break;
      case 1:
        // ATTrackingManagerAuthorizationStatusRestricted case
        break;
      case 2:
        // ATTrackingManagerAuthorizationStatusDenied case
        break;
      case 3:
        // ATTrackingManagerAuthorizationStatusAuthorized case
        break;
    }
  });
}

OR

  1. (better fix) Let requestTrackingAuthorizationWithCompletionHandler return a double or int not a num