requestPermission method

  1. @override
Future<bool> requestPermission()
override

Prompts for notification authorization and reports whether it was granted.

Implementation

@override
Future<bool> requestPermission() async {
  try {
    final granted =
        await _channel.invokeMethod<bool>('requestPermission') ?? false;
    authorized.value = granted;
    return granted;
  } on PlatformException catch (e) {
    _log.w('requestPermission failed: ${e.message}');
    authorized.value = false;
    return false;
  } on MissingPluginException {
    return false;
  }
}