1
answer
1
watching
129
views
dragon2020Lv1
7 Mar 2023
Flutter Program ver 3.7.6 and Android Studio Eel ver 2022.1.1 Patch 1
Just fixed the previous issue forgot to turn it on Developer setting for this question -
Now when I run the flutter program - Program listed below
I get the error msg - HiveError: Box not found. Did you forget to call Hive.openBox()? See screenshot below the flutter program How to resolve this hiveError what command to type in for this so-called box?
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'pages/home_page.dart';
void main() async {
// init the hive
await Hive.initFlutter();
// open a box
var box = await Hive.openBox('mbox');
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: const HomePage(),
theme: ThemeData(primarySwatch: Colors.yellow),
);
}
}
Flutter Program ver 3.7.6 and Android Studio Eel ver 2022.1.1 Patch 1
Just fixed the previous issue forgot to turn it on Developer setting for this question -
Now when I run the flutter program - Program listed below
I get the error msg - HiveError: Box not found. Did you forget to call Hive.openBox()? See screenshot below the flutter program How to resolve this hiveError what command to type in for this so-called box?
import 'package:flutter/material.dart';import 'package:hive_flutter/hive_flutter.dart';
import 'pages/home_page.dart';
void main() async {
// init the hive
await Hive.initFlutter();
// open a box
var box = await Hive.openBox('mbox');
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: const HomePage(),
theme: ThemeData(primarySwatch: Colors.yellow),
);
}
}
Read by 1 person
celluarsolLv10
7 Mar 2023