AuthMessage constructor

AuthMessage({
  1. String? title,
  2. String? hint,
  3. String? reason,
})

Creates a new AuthMessage.

On iOS, reason is required and cannot be empty. On Android, title is required and cannot be empty.

Implementation

AuthMessage({this.title, this.hint, this.reason}) {
  assert(
  !(Platform.isIOS && (reason?.isEmpty ?? true)),
  'iOS requires a reason for biometric prompt.',
  );
  if (Platform.isIOS && (reason?.isEmpty ?? true)) {
    throw ArgumentError('iOS requires a reason for biometric prompt.');
  }

  assert(
  !(Platform.isAndroid && (title?.isEmpty ?? true)),
  'Android requires a title for biometric prompt.',
  );
  if (Platform.isAndroid && (title?.isEmpty ?? true)) {
    throw ArgumentError('Android requires a title for biometric prompt.');
  }
}