Files
Marvin M 7783e412e2 feat: Added core usage logging (#1147)
* feat: Initial tracking structure

* Added testing page

* Created track constructor

* Deleted unneccassary _trackConstructor params

* Finished start track

* Fix id + country

* Finished: trackScannedProduct

* Finished: trackProductPageOpen

* Finished: trackKnowledgePanelOpen

* Finished: trackOpenLink

* Finished: trackPersonalizedRanking

* Finished: trackSearch

* Added documentation + fixed imports

* Code review

* trackKnowledgePanelOpen

* Code review

* Update main.dart
2022-02-18 17:01:14 +01:00

24 lines
702 B
Dart

import 'package:hive_flutter/hive_flutter.dart';
import 'package:smooth_app/database/abstract_dao.dart';
import 'package:smooth_app/database/local_database.dart';
/// Where we store ints.
class DaoInt extends AbstractDao {
DaoInt(final LocalDatabase localDatabase) : 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);
}