maybeMap<TResult extends Object?> method

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

Implementation

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