Преглед на файлове

make memLimit and opsLimit non-nullable and remove null check

ashilkn преди 2 години
родител
ревизия
f2adc32b4b
променени са 2 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 2 2
      lib/models/key_attributes.dart
  2. 1 1
      lib/utils/validator_util.dart

+ 2 - 2
lib/models/key_attributes.dart

@@ -7,8 +7,8 @@ class KeyAttributes {
   final String publicKey;
   final String encryptedSecretKey;
   final String secretKeyDecryptionNonce;
-  final int? memLimit;
-  final int? opsLimit;
+  final int memLimit;
+  final int opsLimit;
   final String masterKeyEncryptedWithRecoveryKey;
   final String masterKeyDecryptionNonce;
   final String recoveryKeyEncryptedWithMasterKey;

+ 1 - 1
lib/utils/validator_util.dart

@@ -25,7 +25,7 @@ void validatePreVerificationStateCheck(
     "secretKeyDecryptionNonce",
   );
   nullOrEmptyArgCheck(keyAttr.publicKey, "publicKey");
-  if ((keyAttr.memLimit ?? 0) <= 0 || (keyAttr.opsLimit ?? 0) <= 0) {
+  if (keyAttr.memLimit <= 0 || keyAttr.opsLimit <= 0) {
     throw ArgumentError("Key mem/OpsLimit can not be null or <0");
   }
   // check password encoding issues