Files
Edouard Marquez a6569866d4 feat: Upgrade the Flutter version to 3.24 (#5613)
* Let's migrate the app to Flutter 3.24

* `openfoodfacts_flutter_lints` from the `main` branch

* A fix for `/// For the world view`
2024-09-26 16:48:01 +02:00

23 lines
607 B
Dart

import 'package:hive_flutter/hive_flutter.dart';
import 'package:smooth_app/database/abstract_dao.dart';
/// Where we store ints.
class DaoInt extends AbstractDao {
DaoInt(super.localDatabase);
static const String _hiveBoxName = 'int';
@override
Future<void> init() async => Hive.openBox<int>(_hiveBoxName);
@override
void registerAdapter() {}
Box<int> _getBox() => Hive.box<int>(_hiveBoxName);
int? get(final String key) => _getBox().get(key);
Future<void> put(final String key, final int? value) async =>
value == null ? _getBox().delete(key) : _getBox().put(key, value);
}