map<TResult extends Object?> method

  1. @optionalTypeArgs
TResult map<TResult extends Object?>({
  1. required TResult postView(
    1. UReplyRefParentPostView value
    ),
  2. required TResult notFoundPost(
    1. UReplyRefParentNotFoundPost value
    ),
  3. required TResult blockedPost(
    1. UReplyRefParentBlockedPost value
    ),
  4. required TResult unknown(
    1. UReplyRefParentUnknown 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( UReplyRefParentPostView value)  postView,required TResult Function( UReplyRefParentNotFoundPost value)  notFoundPost,required TResult Function( UReplyRefParentBlockedPost value)  blockedPost,required TResult Function( UReplyRefParentUnknown value)  unknown,}){
final _that = this;
switch (_that) {
case UReplyRefParentPostView():
return postView(_that);case UReplyRefParentNotFoundPost():
return notFoundPost(_that);case UReplyRefParentBlockedPost():
return blockedPost(_that);case UReplyRefParentUnknown():
return unknown(_that);}
}