14 lines
385 B
Dart
14 lines
385 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
|
|
class HiveRepository extends ChangeNotifier {
|
|
static Future<Box<dynamic>> openHive(String boxname) async {
|
|
var connectionBox = Hive.box<dynamic>(boxname);
|
|
if (!connectionBox.isOpen) {
|
|
connectionBox = await Hive.openBox<dynamic>(boxname);
|
|
}
|
|
|
|
return connectionBox;
|
|
}
|
|
}
|