-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Sudhi S edited this page Jul 28, 2026
·
1 revision
flutter pub add native_datastoreor add to pubspec.yaml:
dependencies:
native_datastore: ^1.6.0import 'package:native_datastore/native_datastore.dart';
final store = NativeDatastore();
await store.setString('username', 'sudhi');
await store.setInt('loginCount', 42);
await store.setBool('darkMode', true);
final name = await store.getString('username'); // 'sudhi'
final count = await store.getInt('loginCount'); // 42All operations are async (they cross a platform channel), so await them.
Missing keys return null — see
Handling Null Values.
String, bool, int, double, List<String>, Uint8List, DateTime,
and Map<String, dynamic>. See
Storage Details
for how each maps onto the native store.
The API is intentionally similar; you can also import existing values in one call:
final imported = await store.migrateFromSharedPreferences();Full guide: Migrating from shared_preferences.
- Storing secrets → Secure Storage
- Background service / app extension → Multi-Process Access
- Something not working → Troubleshooting
native_datastore