Localstorage
Simple json file-based storage for flutter
Installation
Add dependency to pubspec.yaml
dependencies:
...
localstorage: ^1.0.0
Run in your terminal
flutter packages get
Example
class SomeWidget extends StatelessWidget {
final LocalStorage storage = new LocalStorage('some_key');
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: storage.ready,
builder: (BuildContext context, snapshot) {
if (snapshot.data == true) {
Map<String, dynamic> data = storage.getItem('key');
return SomeDataView(data: data);
} else {
return SomeLoadingStateWidget();
}
},
);
}
}
License
MIT