Flutter-Ernaehrungsapp/lib/main.dart

32 lines
959 B
Dart

import 'package:ernaehrung/android/models/food.dart';
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;
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());
}
//await Hive.deleteFromDisk();
await Hive.openBox('STATISTICS_REDUCED');
await Hive.openBox('STATISTICS_PROGRESS');
await Hive.openBox('STATISTICS_MAIN');
await Hive.openBox('TODAY');
setupTodayBox();
//Hive.deleteFromDisk();
if(defaultTargetPlatform == TargetPlatform.android){
runApp(const AndroidApp());
}else if(kIsWeb){
runApp(const WebApp());
}
}