maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult users(
    1. TopChatCategoryUsers value
    )?,
  2. TResult bots(
    1. TopChatCategoryBots value
    )?,
  3. TResult groups(
    1. TopChatCategoryGroups value
    )?,
  4. TResult channels(
    1. TopChatCategoryChannels value
    )?,
  5. TResult inlineBots(
    1. TopChatCategoryInlineBots value
    )?,
  6. TResult guestBots(
    1. TopChatCategoryGuestBots value
    )?,
  7. TResult webAppBots(
    1. TopChatCategoryWebAppBots value
    )?,
  8. TResult calls(
    1. TopChatCategoryCalls value
    )?,
  9. TResult forwardChats(
    1. TopChatCategoryForwardChats value
    )?,
  10. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(TopChatCategoryUsers value)? users,
  TResult Function(TopChatCategoryBots value)? bots,
  TResult Function(TopChatCategoryGroups value)? groups,
  TResult Function(TopChatCategoryChannels value)? channels,
  TResult Function(TopChatCategoryInlineBots value)? inlineBots,
  TResult Function(TopChatCategoryGuestBots value)? guestBots,
  TResult Function(TopChatCategoryWebAppBots value)? webAppBots,
  TResult Function(TopChatCategoryCalls value)? calls,
  TResult Function(TopChatCategoryForwardChats value)? forwardChats,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case TopChatCategoryUsers.constructor:
      if (users != null) {
        return users.call(this as TopChatCategoryUsers);
      }
      break;
    case TopChatCategoryBots.constructor:
      if (bots != null) {
        return bots.call(this as TopChatCategoryBots);
      }
      break;
    case TopChatCategoryGroups.constructor:
      if (groups != null) {
        return groups.call(this as TopChatCategoryGroups);
      }
      break;
    case TopChatCategoryChannels.constructor:
      if (channels != null) {
        return channels.call(this as TopChatCategoryChannels);
      }
      break;
    case TopChatCategoryInlineBots.constructor:
      if (inlineBots != null) {
        return inlineBots.call(this as TopChatCategoryInlineBots);
      }
      break;
    case TopChatCategoryGuestBots.constructor:
      if (guestBots != null) {
        return guestBots.call(this as TopChatCategoryGuestBots);
      }
      break;
    case TopChatCategoryWebAppBots.constructor:
      if (webAppBots != null) {
        return webAppBots.call(this as TopChatCategoryWebAppBots);
      }
      break;
    case TopChatCategoryCalls.constructor:
      if (calls != null) {
        return calls.call(this as TopChatCategoryCalls);
      }
      break;
    case TopChatCategoryForwardChats.constructor:
      if (forwardChats != null) {
        return forwardChats.call(this as TopChatCategoryForwardChats);
      }
      break;
  }
  return orElse.call();
}