map<TResult extends Object?> method
- @optionalTypeArgs
- required TResult fill(
- BackgroundTypeFill value
- required TResult wallpaper(
- BackgroundTypeWallpaper value
- required TResult pattern(
- BackgroundTypePattern value
- required TResult chatTheme(
- BackgroundTypeChatTheme value
A switch-like method, using callbacks.
Callbacks receives the raw object, upcasted. It is equivalent to doing:
switch (sealedClass) {
case final Subclass value:
return ...;
case final Subclass2 value:
return ...;
}
Implementation
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(BackgroundTypeFill value) fill,
required TResult Function(BackgroundTypeWallpaper value) wallpaper,
required TResult Function(BackgroundTypePattern value) pattern,
required TResult Function(BackgroundTypeChatTheme value) chatTheme,
}) {
final _that = this;
switch (_that) {
case BackgroundTypeFill():
return fill(_that);
case BackgroundTypeWallpaper():
return wallpaper(_that);
case BackgroundTypePattern():
return pattern(_that);
case BackgroundTypeChatTheme():
return chatTheme(_that);
}
}