flutter : Firebase token returning null getToken, error fetching instanceID:

763 Views Asked by At

I'm trying to get the FCM token using the firebase_messaging: ^7.0.3 version. Getting the error getToken, error fetching instanceID: FCM token returns a null value.

  static final FirebaseMessaging _firebaseMessaging=FirebaseMessaging();
  static String token;


_firebaseMessaging.requestNotificationPermissions();
      _firebaseMessaging.configure();

      token=await _firebaseMessaging.getToken();
      String token2 = await _firebaseMessaging.getToken().then((String token) {
        assert(token != null);
        print(token);
        return token;
      });
      print(token2);
0

There are 0 best solutions below