import 'package:hive_flutter/hive_flutter.dart'; import 'package:smooth_app/database/abstract_dao.dart'; /// Where we store strings that need INSTANT access (= not lazy, no await). class DaoInstantString extends AbstractDao { DaoInstantString(super.localDatabase); static const String _hiveBoxName = 'instantString'; @override Future init() async => Hive.openBox(_hiveBoxName); @override void registerAdapter() {} Box _getBox() => Hive.box(_hiveBoxName); String? get(final String key) => _getBox().get(key); Future put(final String key, final String? value) async => value == null ? _getBox().delete(key) : _getBox().put(key, value); }