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
555 B

import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
class HiveUtil {
static late final HiveUtil _instance = HiveUtil._();
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');
}
}