Skip to content

daveleenew/flutter_localstorage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Localstorage

Simple json file-based storage for flutter

GitHub stars Twitter Follow

Installation

Add dependency to pubspec.yaml

dependencies:
  ...
  localstorage: ^2.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();
        }
      },
    );
  }
}

Integration tests

cd ~/flutter_localstorage/test
flutter packages get
flutter drive --target=lib/main.dart

License

MIT

GitHub stars Twitter Follow

About

📦Simple localstorage for flutter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 70.8%
  • Ruby 20.3%
  • Objective-C 3.7%
  • Swift 1.9%
  • Java 1.7%
  • Kotlin 1.6%