fnotes/lib/main.dart
Marco 10ad73c940 Adding persistence
This commit adds persistence.
Notes are added to a sqlite database, can be deleted and are read at app
start.
2024-03-29 17:14:47 +01:00

33 lines
845 B
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fnotes/notes_app.dart';
import 'package:fnotes/persistence_bloc.dart';
import 'package:fnotes/theme_bloc.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized(); //for drift
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: [
BlocProvider(create: (context) => ThemeBloc()),
BlocProvider(create: (context) => PersistenceBloc())
],
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
return MaterialApp(
theme: state.theme,
home: const NotesApp(),
);
},
),
);
}
}