map<TResult extends Object?> method

  1. @optionalTypeArgs
TResult map<TResult extends Object?>({
  1. required TResult profileViewDetailed(
    1. UNotificationGetGroupedNotificationsRelatedViewsProfileViewDetailed value
    ),
  2. required TResult blockedPost(
    1. UNotificationGetGroupedNotificationsRelatedViewsBlockedPost value
    ),
  3. required TResult generatorView(
    1. UNotificationGetGroupedNotificationsRelatedViewsGeneratorView value
    ),
  4. required TResult notFoundPost(
    1. UNotificationGetGroupedNotificationsRelatedViewsNotFoundPost value
    ),
  5. required TResult postView(
    1. UNotificationGetGroupedNotificationsRelatedViewsPostView value
    ),
  6. required TResult starterPackView(
    1. UNotificationGetGroupedNotificationsRelatedViewsStarterPackView value
    ),
  7. required TResult unknown(
    1. UNotificationGetGroupedNotificationsRelatedViewsUnknown 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( UNotificationGetGroupedNotificationsRelatedViewsProfileViewDetailed value)  profileViewDetailed,required TResult Function( UNotificationGetGroupedNotificationsRelatedViewsBlockedPost value)  blockedPost,required TResult Function( UNotificationGetGroupedNotificationsRelatedViewsGeneratorView value)  generatorView,required TResult Function( UNotificationGetGroupedNotificationsRelatedViewsNotFoundPost value)  notFoundPost,required TResult Function( UNotificationGetGroupedNotificationsRelatedViewsPostView value)  postView,required TResult Function( UNotificationGetGroupedNotificationsRelatedViewsStarterPackView value)  starterPackView,required TResult Function( UNotificationGetGroupedNotificationsRelatedViewsUnknown value)  unknown,}){
final _that = this;
switch (_that) {
case UNotificationGetGroupedNotificationsRelatedViewsProfileViewDetailed():
return profileViewDetailed(_that);case UNotificationGetGroupedNotificationsRelatedViewsBlockedPost():
return blockedPost(_that);case UNotificationGetGroupedNotificationsRelatedViewsGeneratorView():
return generatorView(_that);case UNotificationGetGroupedNotificationsRelatedViewsNotFoundPost():
return notFoundPost(_that);case UNotificationGetGroupedNotificationsRelatedViewsPostView():
return postView(_that);case UNotificationGetGroupedNotificationsRelatedViewsStarterPackView():
return starterPackView(_that);case UNotificationGetGroupedNotificationsRelatedViewsUnknown():
return unknown(_that);}
}