Flutter-Ernaehrungsapp/lib/main.dart

28 lines
1005 B
Dart

import 'package:ernaehrung/android/models/food.dart';
import 'package:ernaehrung/android/models/user.dart';
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';
void main() async {
await dotenv.load(fileName: ".env");
await Hive.initFlutter();
if (!Hive.isAdapterRegistered(0)) {
Hive.registerAdapter(FoodAdapter());
}
if (!Hive.isAdapterRegistered(1)) {
Hive.registerAdapter(UserAdapter());
}
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');
await Hive.openBox<User>('USER_BOX');
setupTodayBox();
runApp(const AndroidApp());
}