unified_local_data 1.1.1 copy "unified_local_data: ^1.1.1" to clipboard
unified_local_data: ^1.1.1 copied to clipboard

A universal, engine-agnostic local database abstraction layer for Flutter.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:unified_local_data/unified_local_data.dart';
import 'package:path_provider/path_provider.dart';

/// A simple example demonstrating how to use [unified_local_data] with the
/// Hive CE engine.
void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize the data source with the Hive engine.
  final dir = await getApplicationDocumentsDirectory();

  final dataSource = await UnifiedDataSourceFactory.create(
    UnifiedDataSourceConfig.hive(
      directory: dir.path,
      preloadBoxes: ['settings', 'cache'],
    ),
  );

  // Put a simple string value.
  await dataSource.put<String>('settings', 'theme', 'dark');

  // Read it back.
  final String? theme = await dataSource.get<String>('settings', 'theme');
  debugPrint('Stored theme: $theme'); // Stored theme: dark
}
1
likes
110
points
88
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A universal, engine-agnostic local database abstraction layer for Flutter.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, hive_ce, hive_ce_flutter, isar_community, isar_community_flutter_libs, meta, path_provider

More

Packages that depend on unified_local_data