map<TResult extends Object?> method
- @optionalTypeArgs
- required TResult static(
- InputProfilePhotoStatic value
- required TResult animated(
- InputProfilePhotoAnimated 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(InputProfilePhotoStatic value) static,
required TResult Function(InputProfilePhotoAnimated value) animated,
}) {
final _that = this;
switch (_that) {
case InputProfilePhotoStatic():
return static(_that);
case InputProfilePhotoAnimated():
return animated(_that);
}
}