We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Steps to Reproduce Summarizing,
Code sample
import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:hive/hive.dart'; import 'package:hive_flutter/hive_flutter.dart'; import 'package:uuid/uuid.dart'; void main() async { await Hive.initFlutter(); var keyBox = await Hive.openBox('encryptKey'); if (!keyBox.containsKey('key')) { var key = Hive.generateSecureKey(); keyBox.put('key', key); } var key = keyBox.get('key') as Uint8List; print('encryption key-> $key'); var futures = <Future>[]; // first remove "encryptionKey: key" from both futures // then write something // put "encryptionKey: key" on the futures again // then write something // refresh main.dart futures.add(Hive.openBox('first_box', encryptionKey: key)); futures.add(Hive.openBox('second_box', encryptionKey: key)); await Future.wait(futures); runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Experimenting Hive', theme: ThemeData( primarySwatch: Colors.blue, visualDensity: VisualDensity.adaptivePlatformDensity, ), home: MyHome(), ); } } class MyHome extends StatefulWidget { @override _MyHomeState createState() => _MyHomeState(); } class _MyHomeState extends State<MyHome> { String text; Uuid uuid = Uuid(); void handleChange(String newValue) { text = newValue; } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Home'), actions: [ IconButton( icon: Icon(Icons.delete), onPressed: () async { var first = await Hive.openBox('first_box'); var second = await Hive.openBox('second_box'); await first.deleteFromDisk(); await second.deleteFromDisk(); }, ), ], ), body: Container( width: 500, height: 500, child: ValueListenableBuilder( valueListenable: Hive.box('first_box').listenable(), builder: (context, Box<dynamic> box, widget) { List raw = box.values.toList(); print(raw); return Text('Some text'); }, ), ), floatingActionButton: FloatingActionButton( onPressed: () { showModalBottomSheet( context: context, builder: (BuildContext context) { return Container( height: 300, child: Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ Container( width: 140, child: TextField( onChanged: handleChange, ), ), SizedBox( height: 48, ), RaisedButton( onPressed: () async { String key = uuid.v4(); Map<String, String> data = { 'text': text, 'key': key, 'timestamp': DateTime.now() .millisecondsSinceEpoch .toString(), }; var box = await Hive.openBox('first_box'); box.put(key, data); }, child: Icon(Icons.send), ), ], ), ), ); }, ); }, child: Icon(Icons.add), ), ); } }
Provide a few simple lines of code to show your problem.
E/flutter (16256): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: HiveError: This should not happen. Please open an issue on GitHub. E/flutter (16256): #0 BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:249:7) E/flutter (16256): #1 FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:17:26) E/flutter (16256): #2 FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:41:12) E/flutter (16256): <asynchronous suspension> E/flutter (16256): #3 StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:82:30) E/flutter (16256): <asynchronous suspension> E/flutter (16256): #4 BoxBaseImpl.initialize (package:hive/src/box/box_base_impl.dart:90:20) E/flutter (16256): #5 HiveImpl._openBox (package:hive/src/hive_impl.dart:106:22) E/flutter (16256): <asynchronous suspension> E/flutter (16256): #6 HiveImpl.openBox (package:hive/src/hive_impl.dart:135:18) E/flutter (16256): #7 main (package:testing_hive/main.dart:23:20) E/flutter (16256): <asynchronous suspension> E/flutter (16256): #8 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:233:25) E/flutter (16256): #9 _rootRun (dart:async/zone.dart:1190:13) E/flutter (16256): #10 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (16256): #11 _runZoned (dart:async/zone.dart:1630:10) E/flutter (16256): #12 runZonedGuarded (dart:async/zone.dart:1618:12) E/flutter (16256): #13 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:225:5) E/flutter (16256): #14 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19) E/flutter (16256): #15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12) E/flutter (16256): E/flutter (16256): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: HiveError: This should not happen. Please open an issue on GitHub. E/flutter (16256): #0 BinaryReaderImpl.readFrame (package:hive/src/binary/binary_reader_impl.dart:249:7) E/flutter (16256): #1 FrameHelper.framesFromBytes (package:hive/src/binary/frame_helper.dart:17:26) E/flutter (16256): #2 FrameIoHelper.framesFromFile (package:hive/src/io/frame_io_helper.dart:41:12) E/flutter (16256): <asynchronous suspension> E/flutter (16256): #3 StorageBackendVm.initialize (package:hive/src/backend/vm/storage_backend_vm.dart:82:30) E/flutter (16256): <asynchronous suspension> E/flutter (16256): #4 BoxBaseImpl.initialize (package:hive/src/box/box_base_impl.dart:90:20) E/flutter (16256): #5 HiveImpl._openBox (package:hive/src/hive_impl.dart:106:22) E/flutter (16256): <asynchronous suspension> E/flutter (16256): #6 HiveImpl.openBox (package:hive/src/hive_impl.dart:135:18) E/flutter (16256): #7 main (package:testing_hive/main.dart:23:20) E/flutter (16256): <asynchronous suspension> E/flutter (16256): #8 _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:233:25) E/flutter (16256): #9 _rootRun (dart:async/zone.dart:1190:13) E/flutter (16256): #10 _CustomZone.run (dart:async/zone.dart:1093:19) E/flutter (16256): #11 _runZoned (dart:async/zone.dart:1630:10) E/flutter (16256): #12 runZonedGuarded (dart:async/zone.dart:1618:12) E/flutter (16256): #13 _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:225:5) E/flutter (16256): #14 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19) E/flutter (16256): #15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
Version
The text was updated successfully, but these errors were encountered:
Duplication of #263 Thanks
Sorry, something went wrong.
simc
No branches or pull requests
Steps to Reproduce
Summarizing,
Code sample
Provide a few simple lines of code to show your problem.
Version
hive: ^1.4.4
hive_flutter: ^0.3.1
uuid: ^2.2.0
The text was updated successfully, but these errors were encountered: