Open mrwonko opened 11 months ago
PushManager.getSubscription is defined as Future<PushSubscription>, but if there's no subscription, it actually returns null, leading to an Error:
PushManager.getSubscription
Future<PushSubscription>
null
Error: Expected a value of type 'FutureOr', but got one of type 'Null'
According to https://developer.mozilla.org/en-US/docs/Web/API/PushManager/getSubscription, this is expected, and I don't see how else I'd check whether a subscription has been configured yet.
Can be reproduced with
await (await html.window.navigator.serviceWorker?.ready)?.pushManager?.getSubscription();
PushManager.getSubscription
is defined asFuture<PushSubscription>
, but if there's no subscription, it actually returnsnull
, leading to an Error:According to https://developer.mozilla.org/en-US/docs/Web/API/PushManager/getSubscription, this is expected, and I don't see how else I'd check whether a subscription has been configured yet.
Can be reproduced with