I am using android_alarm_manager_plus to run a dart isolate. In that isolate, I modify some data and I want those changes to reflect in the main isolate. Likewise, I want changes made in the main isolate to reflect in the alarm isloate.
What I have tried
Currenlty I am using get_storage to save and read data. But it isn't synchronizing between isolates.
Alarm isolate
await GetStorage.init();
// Some time later
GetStorage().write("data", data);
Main Isolate
await GetStorage.init();
// This read always occurs after the write in the alarm isolate, but it still doesn't reflect the changes made in that write.
GetStorage().read("data");
Before this, I was using shared_preferences to do the same. shared_preferences
actually had a reload method which was supposed to synchronize from disk, but I am not sure how to use it in my use case.
I have also tried the ugly method of writing and reading data to a file manually. This works, but is probably slow and I have to make sure that writes don't overlap (I would prefer not to use synchronous writes since it will block the UI).