I am new to Flutter and developing app which needs to store some amount of data in LocalStorage, I am successfully storing and retrieving data to and from LocalStorage but when I close the App and reopens it, it flushes the entire data, and when we try to access the same data it gives Null. I am attaching my sample code here how I am doing it. Its working fine only issue is it does not persist data after restarting an APP.
void saveData() async{
final LocalStorage storage = new LocalStorage('brick-game');
await storage.setItem('data', _data);
}
@override
Widget build(BuildContext context){
final LocalStorage storage = new LocalStorage('brick-game');
final data = storage.getItem('data');
};
Please let me know what I am doing wrong or anything I am missing. Your help will be appreciated. Thanks