From c2a988d974f281a15d4ba6e94bcb0db30a7a2258 Mon Sep 17 00:00:00 2001 From: Dave Mudit <127575618+mudit1901@users.noreply.github.com> Date: Sun, 20 Aug 2023 11:43:33 +0530 Subject: [PATCH] Update main.dart In this I am adding Flutter Binding and giving the Path for the Database which will be efficient by using Path Provider Package --- lib/main.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 2ea977c..02001f9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,8 +3,10 @@ import 'package:hive_flutter/hive_flutter.dart'; import 'pages/home_page.dart'; void main() async { - // init the hive - await Hive.initFlutter(); + + WidgetsFlutterBinding.ensureInitialized(); + // init the hive + await Hive.initFlutter(getApplicationDocumentsDirectory().toString()); // open a box var box = await Hive.openBox('mybox');