map<TResult extends Object?> method
- @optionalTypeArgs
- required TResult threadViewPost(
- UThreadViewPostParentThreadViewPost value
- required TResult notFoundPost(
- UThreadViewPostParentNotFoundPost value
- required TResult blockedPost(
- UThreadViewPostParentBlockedPost value
- required TResult unknown(
- UThreadViewPostParentUnknown 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( UThreadViewPostParentThreadViewPost value) threadViewPost,required TResult Function( UThreadViewPostParentNotFoundPost value) notFoundPost,required TResult Function( UThreadViewPostParentBlockedPost value) blockedPost,required TResult Function( UThreadViewPostParentUnknown value) unknown,}){
final _that = this;
switch (_that) {
case UThreadViewPostParentThreadViewPost():
return threadViewPost(_that);case UThreadViewPostParentNotFoundPost():
return notFoundPost(_that);case UThreadViewPostParentBlockedPost():
return blockedPost(_that);case UThreadViewPostParentUnknown():
return unknown(_that);}
}