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