Flutter-Ernaehrungsapp/lib/main.dart

42 lines
1010 B
Dart
Raw Normal View History

import 'package:ernaehrung/models/food.dart';
2023-04-23 13:08:04 +02:00
import 'package:ernaehrung/pages/nav_pages/main_page.dart';
import 'package:ernaehrung/views/navigation/navigation_screen.dart';
2023-04-13 23:01:48 +02:00
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'config/setup_todaybox_config.dart';
void main() async {
await dotenv.load(fileName: ".env");
await Hive.initFlutter();
if (! Hive.isAdapterRegistered(1)) {
Hive.registerAdapter(FoodAdapter());
}
await Hive.openBox(dotenv.env['TODAY_BOX']!);
await setupTodayBox();
2023-04-13 23:01:48 +02:00
runApp(const MyApp());
2023-04-13 23:01:48 +02:00
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
2023-04-13 23:01:48 +02:00
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
2023-04-23 13:08:04 +02:00
home: const MainPage(),
routes: {
'/navigation': (context) => const NavigationScreen(),
},
2023-04-13 23:01:48 +02:00
);
}
}