demo_hive/lib/main.dart

49 lines
1.9 KiB
Dart

import 'package:demo_hive/bloc/reminder_bloc.dart';
import 'package:demo_hive/data/data_source/local/local_database-set_up.dart';
import 'package:demo_hive/data/repositories/reminder_repo_impl.dart';
import 'package:demo_hive/service_locator.dart';
import 'package:demo_hive/widget/reminder_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'bloc/reminder_event.dart';
import 'data/data_source/local/local_init.dart';
import 'domain/use_case/reminders_use_case.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
setup();
final localDbSetup = locator<LocalDBInit>();
await localDbSetup.init();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
// This makes the visual density adapt to the platform that you run
// the app on. For desktop platforms, the controls will be smaller and
// closer together (more dense) than on mobile platforms.
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: BlocProvider(
create: (_) => locator<ReminderBloc>()..add(InitialEvent()),
child: ReminderWidget()),
);
}
}