getDeviceToken function Null safety

Future<String?> getDeviceToken()

Implementation

Future<String?> getDeviceToken() async {
  final firebaseMessaging = FirebaseMessaging.instance;
  if (Platform.isIOS) {
    firebaseMessaging.requestPermission();
    await firebaseMessaging.getNotificationSettings();
  }
  final token = await firebaseMessaging.getToken();
  return token;
}