You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
550 B

2 years ago
import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
class HiveUtil {
static final HiveUtil _instance = HiveUtil._();
2 years ago
factory HiveUtil() => _instance;
HiveUtil._();
static init() async {
if (!kIsWeb) {
var dir = await getApplicationDocumentsDirectory();
Hive.init(dir.path);
}
}
Future<Box> get openAppBox async {
return await Hive.openBox('app');
}
Future<Box> get openUserBox async {
return await Hive.openBox('user');
}
}