Question Details

No question body available.

Tags

flutter flutter-dependencies flutter-notification

Answers (1)

January 25, 2026 Score: 0 Rep: 1,632 Quality: Low Completeness: 80%

Given that you are doing a lot of background work, you need to proactively setup for background processes. You might also have to leverage MethodChannels as they run Dart code well when the app is in the background.

The following links will help you:

- Flutter Docs Page on Background Processes: https://docs.flutter.dev/packages-and-plugins/background-processes
- workmanager Package (for consistent schedules): https://pub.dev/packages/workmanager

Given the limits of how many notifications you can schedule, use WorkManager().registerPeriodicTask to check and set for "the next medicine reminders to schedule".

Possibly, you could even forget about scheduling notifications and instantly show them at reminder-time based on how you configure PeriodicTask. However, you might have to be dynamically configuring / scheduling the tasks based on user's inputs. This is hypothetical, haven't tried it to know if it should work.

Implement/Test/Compare this approach with the previous paragraph and use the one that is more faithful because somehow, there are usually delays.

Infact, concerning delays, you could consider adding a checkbox in your UI for users to agree to be reminded 5 mins to time, so that if there are reminder delays, they will not be "so late".


Concerning:

... Also Isar doesn’t work in background mode- thats another issue

Isar can work in the background, what you need is a local shared package with your Isar setup. Then you use it both in the background processes (notification handlers & MethodChannels you might create) and in the UI code.

Your current Isar setup starts in the UI/main thread/isolate and executions there only happen when the app is in foreground. So in the background, you need to launch Isar for it to work there separately. Creating a local shared package allows you to have the same Isar Collections and Objects in both the background processes and in the UI code.

This "creating local shared" was something I figured out when I once worked on something similar, that is, accessing Isar in a notification handler (as it happens in a background process). Creating a package (like those published in pub.dev) is quite easy. Just setup as docs expect but then you don't need to publish it to pub.dev, it can live in the same repo in some packages folder. That's I why I called it local shared package. Check out the Flutter Docs page on this. https://docs.flutter.dev/packages-and-plugins/developing-packages

Ideally, you should be creating a Dart-only package the Isar setup is not necessarily "Flutterish" and the background processes are not also "Flutterish". I'm not sure of this details though, verify when implementing.