flutter_background_service
flutter_background_service copied to clipboard
Background service execute more than 1 times at the same time
Hi,
During the background is running. Sometimes when the background is running, executes the function more than 1 times at the same time. I try to get/post the data through API. some will cause my data to duplicate.
Timer.periodic(const Duration(minutes: 5), (timer) async { if (!isrunning) { if (service is AndroidServiceInstance) { if (await service.isForegroundService()) { foregroundServiceStartController.runService(flutterLocalNotificationsPlugin).then((value) { isrunning = value; }); } } }
how to prevent executing functions more than 1 time at the same time.
any idea?