Overview
CrossLocalStorage is a Flutter/Dart package that provides a unified interface for persistent storage across mobile (Android/iOS), web, and desktop platforms (Windows, macOS, Linux). It wraps SharedPreferences for mobile and web while offering JSON file-based storage for desktop environments. The package ensures consistent data access regardless of platform, simplifying cross-platform app development. It supports both key-value storage and structured JSON file persistence, making it ideal for storing user preferences, app state, or small datasets reliably.
Use cases
- Storing user preferences across platforms
- Persisting app state in multi-platform apps
- Saving configuration files as JSON
- Managing local data in web and desktop apps
- Sharing simple data between mobile and desktop
- Enabling offline-first functionality
Key features
- Unified API for all platforms
- JSON file storage on desktop
- SharedPreferences fallback on mobile/web
- Platform-agnostic data access
- Supports string, int, bool, and complex types
- Automatic serialization/deserialization
Suitable for
- Cross-platform Flutter developers
- Apps requiring local persistence on multiple targets
- Developers avoiding platform-specific code
- Projects using JSON for local data
- Teams prioritizing code reuse
- Apps needing lightweight local storage
Considerations
- Not suitable for large-scale data
- JSON file storage may impact performance on desktop
- Limited to simple data structures
- No built-in encryption
- Requires careful handling of file paths on desktop
- Not designed for high-frequency writes