Flutter-Ernaehrungsapp/lib/main.dart

42 lines
1010 B
Dart

import 'package:ernaehrung/models/food.dart';
import 'package:ernaehrung/pages/nav_pages/main_page.dart';
import 'package:ernaehrung/views/navigation/navigation_screen.dart';
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();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MainPage(),
routes: {
'/navigation': (context) => const NavigationScreen(),
},
);
}
}