AppLockManager constructor

AppLockManager({
  1. required BiometricRepository biometrics,
  2. Duration gracePeriod = Duration.zero,
  3. bool lockOnStart = false,
  4. String reason = 'Unlock to continue',
  5. bool allowDeviceCredential = true,
  6. DateTime now()?,
})

Throws ArgumentError when gracePeriod is negative or reason is blank.

Implementation

AppLockManager({
  required BiometricRepository biometrics,
  this.gracePeriod = Duration.zero,
  bool lockOnStart = false,
  this.reason = 'Unlock to continue',
  this.allowDeviceCredential = true,
  DateTime Function()? now,
}) : _biometrics = biometrics,
     _now = now ?? DateTime.now,
     _locked = lockOnStart {
  if (gracePeriod.isNegative) {
    throw ArgumentError.value(gracePeriod, 'gracePeriod', 'Must be >= 0');
  }
  if (reason.trim().isEmpty) {
    throw ArgumentError.value(reason, 'reason', 'Must not be blank');
  }
}