Closed uddyami closed 3 years ago
@uddyami there was a possibility to instantiate a local storage in isolate, but apparently this functionality was broken when web support was added. I'll work to bring isolate support back
any update for this ?? 🤞
I just checked the code and was able to create an instance of localstorage inside isolate: you need to pass a path to app documents folder (2nd argument of LocalStorage
constructor). getApplicationDocumentsDirectory
from path_provider
doesn't work in isolates, since isolates don't have access to the binary messenger, thus to the underlying platform
Isolate code
// subscribe to messages from main thread
LocalStorage storage;
if (message is Directory) {
storage = LocalStorage('localstorage', message.path);
//-------------------------------------^^^^^^^^^^^^^---
// this prevents localstorage from calling getApplicationDocumentsDirectory
// which is not available from isolates
}
// now you can call localstorage methods
I'm trying to integrate LocalStorage with an Isolate and keep getting