mobileApplicationsKonectarApp/lib/utils/repository.dart

14 lines
385 B
Dart
Raw Normal View History

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;
}
}