2023-05-30 09:38:54 +02:00
|
|
|
import 'package:ernaehrung/android/models/food.dart';
|
2023-05-29 12:08:46 +02:00
|
|
|
import 'package:ernaehrung/web/web_app.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
|
|
|
import 'android/andoird_app.dart';
|
|
|
|
import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb;
|
|
|
|
|
2023-05-30 09:38:54 +02:00
|
|
|
import 'android/config/setup_todaybox_config.dart';
|
|
|
|
|
2023-05-29 12:08:46 +02:00
|
|
|
void main() async {
|
|
|
|
await dotenv.load(fileName: ".env");
|
|
|
|
await Hive.initFlutter();
|
|
|
|
|
2023-05-30 09:38:54 +02:00
|
|
|
if(!Hive.isAdapterRegistered(0)){
|
2023-05-29 12:08:46 +02:00
|
|
|
Hive.registerAdapter(FoodAdapter());
|
|
|
|
}
|
2023-05-30 09:38:54 +02:00
|
|
|
//await Hive.deleteFromDisk();
|
2023-05-29 12:08:46 +02:00
|
|
|
|
2023-05-30 09:38:54 +02:00
|
|
|
await Hive.openBox('STATISTICS_REDUCED');
|
|
|
|
await Hive.openBox('STATISTICS_MAIN');
|
|
|
|
await Hive.openBox('TODAY');
|
|
|
|
setupTodayBox();
|
|
|
|
//Hive.deleteFromDisk();
|
2023-05-29 12:08:46 +02:00
|
|
|
|
|
|
|
if(defaultTargetPlatform == TargetPlatform.android){
|
|
|
|
runApp(const AndroidApp());
|
|
|
|
}else if(kIsWeb){
|
|
|
|
runApp(const WebApp());
|
|
|
|
}
|
|
|
|
}
|