flutter_foreground_service_plugin
flutter_foreground_service_plugin copied to clipboard
Dynamically update notification content?
Is it possible to dynamically update the notification content property of FlutterForegroundPlugin.startForegroundService()?
For example:
var number = 0;
void globalForegroundService() {
number++;
}
void startForegroundService() async {
await FlutterForegroundPlugin.setServiceMethodInterval(seconds:` 1);
await FlutterForegroundPlugin.setServiceMethod(globalForegroundService);
await FlutterForegroundPlugin.startForegroundService(
holdWakeLock: false,
onStarted: () {
print("Foreground on Started");
},
onStopped: () {
print("Foreground on Stopped");
},
title: "Flutter Foreground Service",
content: number.toString(),
iconName: "ic_stat_hot_tub",
);
}
In the content session I would pass the number variable and the notification would reflect the changes each time the number is increased. So far I haven't had any luck with it.