hrt/lib/notification.dart

33 lines
834 B
Dart
Raw Normal View History

2023-10-05 17:33:47 +00:00
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
void sendNotification() async {
var initialized = await FlutterLocalNotificationsPlugin().initialize(
const InitializationSettings(
android: AndroidInitializationSettings('estrogen'),
),
);
if (initialized != true) {
throw "Not initialized";
}
await FlutterLocalNotificationsPlugin().show(
1,
null,
null,
const NotificationDetails(
android: AndroidNotificationDetails(
'hrt',
'HRT',
autoCancel: false,
styleInformation: BigPictureStyleInformation(
DrawableResourceAndroidBitmap('take_your_hrt'),
),
importance: Importance.max,
ongoing: true,
actions: [AndroidNotificationAction("confirmation", "Done!")],
),
),
);
}