18 lines
392 B
Dart
18 lines
392 B
Dart
import 'package:hive/hive.dart';
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
class HiveManager {
|
|
static Box? _userInfoBox;
|
|
|
|
static Future<void> initHive() async {
|
|
final dir = await getApplicationDocumentsDirectory();
|
|
Hive.defaultDirectory = dir.path;
|
|
|
|
_userInfoBox = Hive.box();
|
|
}
|
|
|
|
static String getUserToken() {
|
|
return _userInfoBox?.get('token') ?? '';
|
|
}
|
|
}
|