Open Levi-Lesches opened 1 day ago
@MaikuB I'll once again put in my request to disable the always_specify_types
and lines_longer_than_80_chars
lints, as they cause a lot of headache when trying to write readable code here. Disabling them now won't require changing old code, but will allow cleaner code going forward, and there may be a fair amount of code since this is a big feature. I'll also point out again that always_specify_types
contradicts Effective Dart and there are even replacements such as omit_obvious_local_variable_types
and specify_nonobvious_local_variabletypes
. As for line lengths, the new formatter will allow custom line lengths, for which I find 100 is a reasonable limit, especially with variable names as long as WebFlutterLocalNotificationsPlugin
.
Adds web support. The plan is as follows, taken from https://github.com/MaikuB/flutter_local_notifications/issues/481#issuecomment-2473307972:
NotificationOptions
object supportscancel(id)
by usingServiceWorkerRegistration.getNotifications()
to get the notification in question, then callingNotification.cancel()
cancelAll()
by callingNotification.cancel()
for all the notifications returned byServiceWorkerRegistration.getNotifications()
getActiveNotifications()
by returning the result ofServiceWorkerRegistration.getNotifications()
getNotificationAppLaunchDetails
by having the service worker pass the initial event to the new windowpendingNotificationRequest
could return an empty listperiodicallyShow
, andperiodicallyShowWithDuration
would not be supported. They could be safely modified to returnFuture<bool>
to see whether they succeeded.show()
would be supported by either creating aNotification
object or usingServiceWorkerRegistration.showNotification()
Of course,
getNotificationAppLaunchDetails
and setting any handlers would require the ability to customize the service worker. That appears to be blocked on flutter/flutter#145828, but after reading flutter/flutter#156910, it seems that today's service worker is not technically needed and can be replaced. While we wait for an official mechanism to do so, there is a way to do so today:Where our custom service worker can start off as simple as
Where of course we'd add more to pass the details of the notification into the Flutter app, and let the plugin pull the data.
Update: Next on my to-do list: customizing notifications with details