Flutter-Ernaehrungsapp/lib/main.dart

28 lines
1005 B
Dart
Raw Normal View History

import 'package:ernaehrung/android/models/food.dart';
2023-05-31 23:22:38 +02:00
import 'package:ernaehrung/android/models/user.dart';
2023-05-29 12:08:46 +02:00
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'android/android_app.dart';
import 'android/config/setup_todaybox_config.dart';
2023-06-01 12:14:23 +02:00
2023-05-29 12:08:46 +02:00
void main() async {
await dotenv.load(fileName: ".env");
await Hive.initFlutter();
2023-05-31 23:22:38 +02:00
if (!Hive.isAdapterRegistered(0)) {
2023-05-29 12:08:46 +02:00
Hive.registerAdapter(FoodAdapter());
}
2023-05-31 23:22:38 +02:00
if (!Hive.isAdapterRegistered(1)) {
Hive.registerAdapter(UserAdapter());
}
2023-06-01 12:14:23 +02:00
await Hive.openBox(dotenv.env['STATISTICS_TODAY_BOX'] ?? 'STATISTICS_TODAY_BOX');
await Hive.openBox( dotenv.env['STATISTICS_PROGRESS_BOX'] ?? 'STATISTICS_PROGRESS_BOX');
await Hive.openBox(dotenv.env['STATISTICS_MAIN_BOX'] ?? 'STATISTICS_MAIN_BOX');
await Hive.openBox(dotenv.env['MEALPLAN_BOX'] ?? 'MEALPLAN');
2023-05-31 23:22:38 +02:00
await Hive.openBox<User>('USER_BOX');
setupTodayBox();
2023-06-16 11:44:42 +02:00
runApp(const AndroidApp());
2023-05-29 12:08:46 +02:00
2023-05-31 23:22:38 +02:00
}