2023-05-12 18:12:28 +02:00
|
|
|
|
|
|
|
import 'package:ernaehrung/web/web_app.dart';
|
2023-04-13 23:01:48 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2023-05-10 00:04:33 +02:00
|
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
2023-05-12 18:12:28 +02:00
|
|
|
import 'android/andoird_app.dart';
|
|
|
|
import 'android/config/setup_todaybox_config.dart';
|
|
|
|
import 'android/models/food.dart';
|
|
|
|
import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb;
|
2023-05-10 00:04:33 +02:00
|
|
|
|
|
|
|
void main() async {
|
|
|
|
await dotenv.load(fileName: ".env");
|
|
|
|
await Hive.initFlutter();
|
|
|
|
|
2023-05-14 09:22:26 +02:00
|
|
|
if (!Hive.isAdapterRegistered(1)) {
|
2023-05-10 00:04:33 +02:00
|
|
|
Hive.registerAdapter(FoodAdapter());
|
|
|
|
}
|
|
|
|
|
2023-05-14 09:22:26 +02:00
|
|
|
|
2023-05-10 00:04:33 +02:00
|
|
|
await Hive.openBox(dotenv.env['TODAY_BOX']!);
|
|
|
|
await setupTodayBox();
|
2023-04-13 23:01:48 +02:00
|
|
|
|
2023-05-12 18:12:28 +02:00
|
|
|
if(defaultTargetPlatform == TargetPlatform.android){
|
|
|
|
runApp(const AndroidApp());
|
|
|
|
}else if(kIsWeb){
|
|
|
|
runApp(const WebApp());
|
2023-04-13 23:01:48 +02:00
|
|
|
}
|
2023-05-12 18:12:28 +02:00
|
|
|
}
|