1
answer
1
watching
129
views

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),
);
}
}

For unlimited access to Homework Help, a Homework+ subscription is required.

Avatar image
Read by 1 person

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in

Related questions

Weekly leaderboard

Start filling in the gaps now
Log in