29 lines
895 B
Dart
29 lines
895 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
|
import 'app.dart';
|
|
import 'helper/setup_todaybox.dart';
|
|
import 'models/food.dart';
|
|
import 'models/user.dart';
|
|
|
|
|
|
void main() async {
|
|
await dotenv.load(fileName: ".env");
|
|
await Hive.initFlutter();
|
|
if (!Hive.isAdapterRegistered(0)) {
|
|
Hive.registerAdapter(FoodAdapter());
|
|
}
|
|
if (!Hive.isAdapterRegistered(1)) {
|
|
Hive.registerAdapter(UserAdapter());
|
|
}
|
|
await Hive.openBox(dotenv.env['PROGRESS_BOX'] ?? 'PROGRESS');
|
|
await Hive.openBox( dotenv.env['STATISTICS_BOX'] ?? 'STATISTICS');
|
|
await Hive.openBox(dotenv.env['MAIN_BOX'] ?? 'MAIN');
|
|
await Hive.openBox(dotenv.env['TODAY_BOX'] ?? 'TODAY');
|
|
await Hive.openBox<User>(dotenv.env['USER_BOX'] ?? 'USER');
|
|
setupTodayBox();
|
|
//Hive.deleteFromDisk();
|
|
runApp(const AndroidApp());
|
|
|
|
}
|