2023-05-29 12:08:46 +02:00
|
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import '../models/food.dart';
|
|
|
|
|
|
|
|
final List<Food> emptyList = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-30 09:38:54 +02:00
|
|
|
void setupTodayBox() async{
|
2023-06-01 12:14:23 +02:00
|
|
|
final todayBox = Hive.box(dotenv.env['MEALPLAN_BOX']!);
|
2023-05-30 09:38:54 +02:00
|
|
|
putIfKeyNotExists(todayBox, 'FRÜHSTÜCK', []);
|
|
|
|
putIfKeyNotExists(todayBox, 'MITTAGESSEN', []);
|
|
|
|
putIfKeyNotExists(todayBox, 'ABENDESSEN', []);
|
2023-05-29 12:08:46 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-05-30 09:38:54 +02:00
|
|
|
void putIfKeyNotExists(Box box, String key, List<Food> value) {
|
|
|
|
if (!box.containsKey(key)) {
|
|
|
|
box.put(key, value);
|
2023-05-29 12:08:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
String getFormatedTodayDate(){
|
|
|
|
return DateTime.now().toString().substring(0,10);
|
|
|
|
}
|