When using the hive_flutter package (version: 2.0.0-dev), a runtime error occurs if the encryptionCipher parameter is set to null. The error trace points to internal Dart SDK files and Hive's binary reader implementation, which indicates that the current logic does not properly handle a null value for encryptionCipher.
Here is the relevant code snippet causing the issue:
Initialize the Hive database using the hive_flutter package.
Attempt to open a Hive box with the encryptionCipher parameter set to null.
Observe the runtime error.
Expected Behavior:
If encryptionCipher is null, the Hive.openBox method should handle it gracefully, avoiding the runtime error.
Alternatively, there should be documentation or validation preventing null from being passed to encryptionCipher.
Proposed Solution:
Modify the internal logic to properly handle null values for the encryptionCipher parameter.
Add validation in the Hive.openBox method to ensure encryptionCipher is not null or provide a meaningful error message if it is or vice versa add extra null check.
This issue might impact developers who prefer conditional encryption based on user settings. Ensuring the encryptionCipher can be safely set to null or handled internally would improve the robustness of the hive_flutter package.
When using the
hive_flutter
package (version:2.0.0-dev
), a runtime error occurs if theencryptionCipher
parameter is set tonull
. The error trace points to internal Dart SDK files and Hive's binary reader implementation, which indicates that the current logic does not properly handle anull
value forencryptionCipher
.Here is the relevant code snippet causing the issue:
Error Trace:
Steps to Reproduce:
hive_flutter
package.encryptionCipher
parameter set tonull
.Expected Behavior:
encryptionCipher
isnull
, theHive.openBox
method should handle it gracefully, avoiding the runtime error.null
from being passed toencryptionCipher
.Proposed Solution:
null
values for theencryptionCipher
parameter.Hive.openBox
method to ensureencryptionCipher
is notnull
or provide a meaningful error message if it is or vice versa add extra null check.Environment:
hive_flutter
version:2.0.0-dev
Additional Information:
This issue might impact developers who prefer conditional encryption based on user settings. Ensuring the
encryptionCipher
can be safely set tonull
or handled internally would improve the robustness of thehive_flutter
package.Labels: