hive icon indicating copy to clipboard operation
hive copied to clipboard

Specifying default value when reading a key that doesn't exist is returning null

Open khoafornia opened this issue 3 years ago • 0 comments

Steps to Reproduce

  1. Open a Hive box
  2. Specify a default value of false and read a key that does not exist.
  3. Notice null is returned instead of false.

Code sample

await Hive.openBox('hiveBoxName');
return Hive.box('hiveBoxName').get('keyThatDoesNotExist', defaultValue: false);

Version

  • Platform: iOS, Android
  • Flutter version: 3.0.4
  • Hive version: 2.1.0

khoafornia avatar Aug 04 '22 01:08 khoafornia