diameter/lib/models/log_bolus.dart
2021-11-25 19:25:13 +01:00

40 lines
950 B
Dart

import 'package:diameter/main.dart';
import 'package:diameter/models/bolus.dart';
import 'package:diameter/models/log_entry.dart';
import 'package:diameter/models/log_meal.dart';
import 'package:diameter/objectbox.g.dart';
import 'package:objectbox/objectbox.dart';
@Entity(uid: 8033487006694871160)
class LogBolus {
static final Box<LogBolus> box = objectBox.store.box<LogBolus>();
int id;
double units;
double? carbs;
int? delay;
int? mgPerDl;
double? mmolPerL;
bool setManually;
String? notes;
final logEntry = ToOne<LogEntry>();
final rate = ToOne<Bolus>();
final meal = ToOne<LogMeal?>();
LogBolus({
this.id = 0,
this.units = 0,
this.carbs,
this.delay,
this.mgPerDl,
this.mmolPerL,
this.setManually = false,
this.notes,
});
static LogBolus? get(int id) => box.get(id);
static void put(LogBolus logBolus) => box.put(logBolus);
static void remove(int id) => box.remove(id);
}