Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

flutter firebase notification token

//Add this to get the notification token of the user in flutter firebase app  

  if (GetStorage().read('token') == null) {
      final _firebaseMessaging = FirebaseMessaging.instance;
      _firebaseMessaging.getToken().then((value) async {
        //save that token to database                                 
        //await Database(uid: currentUser!.uid).createToken(token: '$value');
        GetStorage().write("token", '$value');
      });
    }
 
PREVIOUS NEXT
Tagged: #flutter #firebase #notification #token
ADD COMMENT
Topic
Name
8+7 =