[go: up one dir, main page]

ifl 0.0.3 copy "ifl: ^0.0.3" to clipboard
ifl: ^0.0.3 copied to clipboard

Contract-first storage package for Flutter apps with Hive and secure key-value adapters.

ifl #

Contract-first storage foundation for Flutter apps.

Public API #

  • package:ifl/ifl.dart
    • Contracts only (Storage, KvStorage, DatabaseStorage)
  • package:ifl/ifl_hive.dart
    • Stable Hive entrypoint (initHiveKvStorage)
  • package:ifl/ifl_secure.dart
    • Stable secure storage entrypoint (createSecureKvStorage)

Example: use Hive + Secure KV together #

import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:ifl/ifl.dart';
import 'package:ifl/ifl_hive.dart';
import 'package:ifl/ifl_secure.dart';

Future<void> setupStorage() async {
  final KvStorage hiveKv = await initHiveKvStorage(boxName: 'app_cache');
  final KvStorage secureKv = createSecureKvStorage(
    name: 'secure_user',
    storage: const FlutterSecureStorage(),
  );

  await secureKv.write('token', 'xxx');
  await hiveKv.write('profile', '{"name":"if"}');
}

Defaults:

  • boxName = '@ifl'
  • subDir = 'kv_storage'
  • after first initialization, a different subDir will be ignored (with log)

Notes #

  • Avoid importing package:ifl/src/... directly in app code.
  • Keep business code dependent on KvStorage contract, not concrete engines.
1
likes
150
points
100
downloads

Publisher

verified publishershuothink.com

Weekly Downloads

Contract-first storage package for Flutter apps with Hive and secure key-value adapters.

Repository (GitHub)
View/report issues
Contributing

Topics

#storage #flutter #hive #secure-storage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_secure_storage, hive, hive_flutter

More

Packages that depend on ifl