checkPermissions method

Future<void> checkPermissions()

Implementation

Future<void> checkPermissions() async {
  var settings = await FirebaseMessaging.instance.getNotificationSettings();

  if (settings.authorizationStatus != AuthorizationStatus.authorized) {
    await FirebaseMessaging.instance.requestPermission();
    settings = await FirebaseMessaging.instance.getNotificationSettings();
    _messagingAllowed =
        (settings.authorizationStatus == AuthorizationStatus.authorized);
  } else {
    _messagingAllowed = true;
  }
}