getDeviceToken static method

Future<String> getDeviceToken()

Implementation

static Future<String> getDeviceToken() async {
  final FirebaseMessaging fcm = FirebaseMessaging.instance;
  var deviceToken = "";
  try {
    final token = await fcm.getToken();
    deviceToken = token.toString();
  } catch (error) {
    if (kDebugMode) {
      print(error);
    }
  }
  return deviceToken;
}