Flutter-Ernaehrungsapp/lib/main.dart

29 lines
895 B
Dart
Raw Normal View History

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';
2023-06-25 14:43:07 +02:00
import 'app.dart';
import 'helper/setup_todaybox.dart';
import 'models/food.dart';
import 'models/user.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-25 14:43:07 +02:00
await Hive.openBox(dotenv.env['PROGRESS_BOX'] ?? 'PROGRESS');
await Hive.openBox( dotenv.env['STATISTICS_BOX'] ?? 'STATISTICS');
await Hive.openBox(dotenv.env['MAIN_BOX'] ?? 'MAIN');
await Hive.openBox(dotenv.env['TODAY_BOX'] ?? 'TODAY');
await Hive.openBox<User>(dotenv.env['USER_BOX'] ?? 'USER');
setupTodayBox();
2023-06-25 14:43:07 +02:00
//Hive.deleteFromDisk();
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
}