localstorage
6.0.0, released 2 years ago by lesnitsky.dev
LocalStorage for Flutter and Web, alternative to React Native's AsyncStorage.
WASM-ready
What it does
Provides a simple local key-value storage mechanism for Flutter applications, supporting Android, iOS, Web, Windows, macOS, and Linux. It exposes a synchronous API consistent with the web window.localStorage.
AI-written summary of version 6.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need a simple key-value storage solution similar to web localStorage.
- You want to store small amounts of non-sensitive configuration or state data.
Skip it when
- You need to store large amounts of data.
- You need to store sensitive or highly secure data.
Strengths
- Synchronous API that is consistent with web window.localStorage
- Cross-platform support including Web, WASM, mobile, and desktop.
Weaknesses
- Not intended for large amounts of data
- Not intended for sensitive data
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Call initLocalStorage() after WidgetsFlutterBinding.ensureInitialized() before usage.
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await initLocalStorage();
localStorage.setItem('counter', '0');
String? value = localStorage.getItem('counter');
}Alternatives
Packages that do the same job and could replace localstorage.
- async_storage_reader
Read React Native AsyncStorage data in a Flutter app
36Compare
Works with
Packages commonly used together with localstorage: ones it builds on, ones built on it, and its own family.
- weblocalstorage depends on itLightweight bindings for browser APIs via JS interop
- path_providerlocalstorage depends on itProvides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.
- json_cacheBuilt on localstorageUnifies local storage packages under a single object-oriented JSON caching interface.