maybeMap<TResult extends Object?> method

TResult maybeMap<TResult extends Object?>({
  1. TResult chatTheme(
    1. BackgroundTypeChatTheme value
    )?,
  2. TResult fill(
    1. BackgroundTypeFill value
    )?,
  3. TResult pattern(
    1. BackgroundTypePattern value
    )?,
  4. TResult wallpaper(
    1. BackgroundTypeWallpaper value
    )?,
  5. required TResult orElse(),
})

Implementation

TResult maybeMap<TResult extends Object?>({
  TResult Function(BackgroundTypeChatTheme value)? chatTheme,
  TResult Function(BackgroundTypeFill value)? fill,
  TResult Function(BackgroundTypePattern value)? pattern,
  TResult Function(BackgroundTypeWallpaper value)? wallpaper,
  required TResult Function() orElse,
}) {
  switch (getConstructor()) {
    case BackgroundTypeChatTheme.constructor:
      if (chatTheme != null) {
        return chatTheme.call(this as BackgroundTypeChatTheme);
      }
      break;
    case BackgroundTypeFill.constructor:
      if (fill != null) {
        return fill.call(this as BackgroundTypeFill);
      }
      break;
    case BackgroundTypePattern.constructor:
      if (pattern != null) {
        return pattern.call(this as BackgroundTypePattern);
      }
      break;
    case BackgroundTypeWallpaper.constructor:
      if (wallpaper != null) {
        return wallpaper.call(this as BackgroundTypeWallpaper);
      }
      break;
  }
  return orElse.call();
}