maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult calls(
    1. NotificationGroupTypeCalls value
    )?,
  2. TResult mentions(
    1. NotificationGroupTypeMentions value
    )?,
  3. TResult messages(
    1. NotificationGroupTypeMessages value
    )?,
  4. TResult secretChat(
    1. NotificationGroupTypeSecretChat value
    )?,
  5. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(NotificationGroupTypeCalls value)? calls,
  TResult Function(NotificationGroupTypeMentions value)? mentions,
  TResult Function(NotificationGroupTypeMessages value)? messages,
  TResult Function(NotificationGroupTypeSecretChat value)? secretChat,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case NotificationGroupTypeCalls.constructor:
      if (calls != null) {
        return calls.call(this as NotificationGroupTypeCalls);
      }
      break;
    case NotificationGroupTypeMentions.constructor:
      if (mentions != null) {
        return mentions.call(this as NotificationGroupTypeMentions);
      }
      break;
    case NotificationGroupTypeMessages.constructor:
      if (messages != null) {
        return messages.call(this as NotificationGroupTypeMessages);
      }
      break;
    case NotificationGroupTypeSecretChat.constructor:
      if (secretChat != null) {
        return secretChat.call(this as NotificationGroupTypeSecretChat);
      }
      break;
  }
  return orElse.call();
}