isOptedIn property

Future<bool> get isOptedIn

Returns whether the user is currently opted-in to receive push notifications. FCM is the primary channel going forward, so this reflects FCM's state whenever it's configured for the app; falls back to OneSignal for apps that don't have firebaseOptions set yet.

Implementation

static Future<bool> get isOptedIn async {
  if (AdhubFcm.isInitialized) {
    return AdhubFcm.isOptedIn;
  }
  return OneSignal.User.pushSubscription.optedIn ?? false;
}