-
Notifications
You must be signed in to change notification settings - Fork 28.6k
Error when running Flutter web with --web-experimental-hot-reload
after upgrading to Flutter 3.32.0 (Hive: TypeError: dart.nullCheck(...)[$open] is not a function
)
#169222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
hi @AliKarimiENT, it looks like the issue is related to the plugin (hive in this case) itself and not the flutter SDK if you check the error. so you will need to file the issue in dedicated repo. I tried reproducing this with normal counter app, which works fine. |
I've got the same error, it is because I use if (!Hive.isBoxOpen('MyBoxName')) , in my data layer,[edit: no... even if I use Hive.openBox('boxname') in the main() diectly, I still get the error] this issue only uccurs when I use "--web-experimental-hot-reload" in my vscode config.json, the config is exactly the same as above. when I use regular command run, it works fine, IDK, |
Yes exactly I have the same issue |
the issue is related to the hive package itself then so you will need to file the issue in dedicated repo. |
Yes I reported it to the hive_ce package an updated the fork of the main package. |
@tirth-patel-nc How is this caused by Hive if the same code runs without hot reload enabled? |
Triage ReportI was not able to reproduce the issue using the official sample available for hive_ce_flutter on either the ![]() Code Sampleimport 'package:flutter/material.dart';
import 'package:hive_ce_flutter/hive_flutter.dart';
const counterBox = 'counter';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Hive.initFlutter();
final box = await Hive.openBox(counterBox);
if (box.isEmpty) {
await box.add(0);
}
runApp(const MaterialApp(home: HiveCounterApp()));
}
class HiveCounterApp extends StatelessWidget {
const HiveCounterApp({super.key});
@override
Widget build(BuildContext context) {
final box = Hive.box(counterBox);
return Scaffold(
appBar: AppBar(title: const Text('Hive CE Example')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('You have pushed the button this many times:'),
ValueListenableBuilder(
valueListenable: box.listenable(),
builder: (context, box, widget) {
return Text(
box.getAt(0).toString(),
style: Theme.of(context).textTheme.headlineMedium,
);
},
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () => box.putAt(0, box.getAt(0) + 1),
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
} stable (3.32.0) - flutter doctor -v
master (3.33.0-1.0.pre.186) - flutter doctor -v
|
Let me check with this package |
Switching to |
I was under the impression this issue was with Hive CE. The original Hive uses legacy JS interop so that's probably the issue. |
Uh oh!
There was an error while loading. Please reload this page.
Steps to reproduce
launch.json
contains:Expected results
--web-experimental-hot-reload
enabled, without error.Actual results
Error when running Flutter web with
--web-experimental-hot-reload
after upgrading to Flutter 3.32.0 (Hive:TypeError: dart.nullCheck(...)[$open] is not a function
)--web-experimental-hot-reload
.Code sample
Relevant Code Snippets
main.dart
launch.json
Screenshots or Video
No response
Logs
Logs
Flutter Doctor output
Doctor output
[Paste your output here]
The text was updated successfully, but these errors were encountered: