added provider for state management & exposed db using provider
This commit is contained in:
@@ -1,8 +1,16 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/data/database.dart';
|
||||||
import 'package:game_tracker/presentation/views/home_view.dart';
|
import 'package:game_tracker/presentation/views/home_view.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MyApp());
|
runApp(
|
||||||
|
Provider<AppDatabase>(
|
||||||
|
create: (context) => AppDatabase(),
|
||||||
|
child: MyApp(),
|
||||||
|
dispose: (context, db) => db.close(),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
|||||||
Reference in New Issue
Block a user