33 lines
834 B
Dart
33 lines
834 B
Dart
|
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!")],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|