maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult appleId(
    1. EmailAddressAuthenticationAppleId value
    )?,
  2. TResult code(
    1. EmailAddressAuthenticationCode value
    )?,
  3. TResult googleId(
    1. EmailAddressAuthenticationGoogleId value
    )?,
  4. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(EmailAddressAuthenticationAppleId value)? appleId,
  TResult Function(EmailAddressAuthenticationCode value)? code,
  TResult Function(EmailAddressAuthenticationGoogleId value)? googleId,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case EmailAddressAuthenticationAppleId.constructor:
      if (appleId != null) {
        return appleId.call(this as EmailAddressAuthenticationAppleId);
      }
      break;
    case EmailAddressAuthenticationCode.constructor:
      if (code != null) {
        return code.call(this as EmailAddressAuthenticationCode);
      }
      break;
    case EmailAddressAuthenticationGoogleId.constructor:
      if (googleId != null) {
        return googleId.call(this as EmailAddressAuthenticationGoogleId);
      }
      break;
  }
  return orElse.call();
}