maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult channel(
    1. ChatStatisticsChannel value
    )?,
  2. TResult supergroup(
    1. ChatStatisticsSupergroup value
    )?,
  3. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(ChatStatisticsChannel value)? channel,
  TResult Function(ChatStatisticsSupergroup value)? supergroup,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case ChatStatisticsChannel.constructor:
      if (channel != null) {
        return channel.call(this as ChatStatisticsChannel);
      }
      break;
    case ChatStatisticsSupergroup.constructor:
      if (supergroup != null) {
        return supergroup.call(this as ChatStatisticsSupergroup);
      }
      break;
  }
  return orElse.call();
}