-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating to latest api #104
Comments
I found a (not so great) solution. I had to add a dependency on path_provider and then I added the following code to my main method: void main() async {
WidgetsFlutterBinding.ensureInitialized();
String appDirectory = (await getApplicationDocumentsDirectory()).path;
File oldLocalStorageFile = File(appDirectory + '/' + Constants.storage);
File newLocalStorageFile = File(appDirectory + '/' + 'storage-61f76cb0-842b-4318-a644-e245f50a0b5a.json');
if (oldLocalStorageFile.existsSync()){
if (newLocalStorageFile.existsSync()){
newLocalStorageFile.deleteSync();
}
oldLocalStorageFile.copySync(newLocalStorageFile.path);
oldLocalStorageFile.deleteSync();
};
await initLocalStorage();
runApp(MyApp());
} I'd much prefer to have an option such as : |
I will add migration functionality to the API |
What if you used to have multiple different local storages? |
Are there any updates about the migration solution? |
Up I use localstorage in that way |
Hi there, how does this work? It seems to me you are deleting the new local storage file but also copying and deleting it as the old local storage file? |
sorry I read the copy function backwards, this makes sense and helps a lot until migration functionality is added. thank you :) |
I used to access local storage like this:
LocalStorage(Constants.storage)
but with the updated api there's no way to access the data that used to be at that location. Is there a way to migrate the old data so users in my app don't lose their configs?The text was updated successfully, but these errors were encountered: