Skip to content
pubscout

local_shared

4.0.0, released 9 days ago by inidia.app

Lightweight cross-platform secure local JSON storage for collections and documents.

WASM-ready
$ flutter pub add local_shared
Source repository

What it does

Local Shared is a secure wrapper for JSON file-based local storage that provides CRUD operations for collections and documents, batch operations, migration semantics, and stream updates across all platforms.

AI-written summary of version 4.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need secure local JSON storage for collections and documents.
  • You require stream-based observation of changes in local collections.
  • You want cross-platform support including Android, iOS, web, Windows, macOS, and Linux.

Skip it when

  • You need a full relational SQL database with complex querying capabilities.
  • You require high-performance raw key-value caching without JSON overhead.

Strengths

  • Tested CRUD operations for both collections and single/multiple documents.
  • Built-in stream updates for observing data changes.
  • Security hardening with resilient keystore handling and auto-wipe mechanisms.

Weaknesses

  • Relies on JSON file-based wrapping which may not scale for massive datasets.
  • Limited to specific collection and document structures provided by the package API.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2

Initialize the LocalShared instance in your main function after ensuring Flutter is properly initialized.

import 'package:local_shared/local_shared.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await LocalShared('db').initialize();
  
  final result = await Shared.col('myCollection').doc('documentId').create({'key': 'value'});
}

Alternatives

Packages that do the same job and could replace local_shared.

  • sqflite

    If you require a full relational SQLite database for complex queries and high performance.

Works with

Packages commonly used together with local_shared: ones it builds on, ones built on it, and its own family.