2022-02-03 18:06:44 +02:00
|
|
|
import 'package:hive/hive.dart';
|
2022-06-25 20:46:51 +02:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2022-02-03 18:06:44 +02:00
|
|
|
import 'package:immich_mobile/constants/hive_box.dart';
|
|
|
|
|
2022-06-25 20:46:51 +02:00
|
|
|
final localStorageServiceProvider = Provider((_) => LocalStorageService());
|
|
|
|
|
2022-02-03 18:06:44 +02:00
|
|
|
class LocalStorageService {
|
|
|
|
late Box _box;
|
|
|
|
|
|
|
|
LocalStorageService() {
|
|
|
|
_box = Hive.box(userInfoBox);
|
|
|
|
}
|
|
|
|
|
|
|
|
T get<T>(String key) {
|
|
|
|
return _box.get(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
put<T>(String key, T value) {
|
|
|
|
return _box.put(key, value);
|
|
|
|
}
|
|
|
|
}
|