Skip to content

Commit 111d27d

Browse files
committed
📝 add important initialization instructions for Hive backend in README
1 parent f65ecda commit 111d27d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/hyper_storage_hive/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,24 @@ Then, run `flutter pub get` or `dart pub get`.
2929

3030
Initialize `hyper_storage` with `HiveBackend`.
3131

32+
### IMPORTANT
33+
> Hive backend requires initialization of Hive before use. Hyper Storage doesn't handle Hive initialization for you as
34+
> the initialization depends on whether the project is being used in Flutter or pure Dart environment.
35+
> You need to initialize Hive in your application before using the Hive backend.
36+
3237
```dart
3338
import 'package:hyper_storage/hyper_storage.dart';
3439
import 'package:hyper_storage_hive/hyper_storage_hive.dart';
3540
3641
void main() async {
42+
43+
// IMPORTANT:
44+
// Hive.initFlutter() or Hive.init() must be called before using HiveBackend.
45+
// For Flutter:
46+
// await Hive.initFlutter();
47+
// For pure Dart:
48+
// Hive.init('path_to_hive_boxes');
49+
3750
// Initialize the storage with HiveBackend
3851
final storage = await HyperStorage.init(backend: HiveBackend());
3952

0 commit comments

Comments
 (0)