maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult channelChats(
    1. NotificationSettingsScopeChannelChats value
    )?,
  2. TResult groupChats(
    1. NotificationSettingsScopeGroupChats value
    )?,
  3. TResult privateChats(
    1. NotificationSettingsScopePrivateChats value
    )?,
  4. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(NotificationSettingsScopeChannelChats value)? channelChats,
  TResult Function(NotificationSettingsScopeGroupChats value)? groupChats,
  TResult Function(NotificationSettingsScopePrivateChats value)? privateChats,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case NotificationSettingsScopeChannelChats.constructor:
      if (channelChats != null) {
        return channelChats.call(
          this as NotificationSettingsScopeChannelChats,
        );
      }
      break;
    case NotificationSettingsScopeGroupChats.constructor:
      if (groupChats != null) {
        return groupChats.call(this as NotificationSettingsScopeGroupChats);
      }
      break;
    case NotificationSettingsScopePrivateChats.constructor:
      if (privateChats != null) {
        return privateChats.call(
          this as NotificationSettingsScopePrivateChats,
        );
      }
      break;
  }
  return orElse.call();
}