mapOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? profileViewDetailed(
- UNotificationGetGroupedNotificationsRelatedViewsProfileViewDetailed value
- TResult? blockedPost(
- UNotificationGetGroupedNotificationsRelatedViewsBlockedPost value
- TResult? generatorView(
- UNotificationGetGroupedNotificationsRelatedViewsGeneratorView value
- TResult? notFoundPost(
- UNotificationGetGroupedNotificationsRelatedViewsNotFoundPost value
- TResult? postView(
- UNotificationGetGroupedNotificationsRelatedViewsPostView value
- TResult? starterPackView(
- UNotificationGetGroupedNotificationsRelatedViewsStarterPackView value
- TResult? unknown(
- UNotificationGetGroupedNotificationsRelatedViewsUnknown value
A variant of map that fallback to returning null.
It is equivalent to doing:
switch (sealedClass) {
case final Subclass value:
return ...;
case _:
return null;
}
Implementation
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>({TResult? Function( UNotificationGetGroupedNotificationsRelatedViewsProfileViewDetailed value)? profileViewDetailed,TResult? Function( UNotificationGetGroupedNotificationsRelatedViewsBlockedPost value)? blockedPost,TResult? Function( UNotificationGetGroupedNotificationsRelatedViewsGeneratorView value)? generatorView,TResult? Function( UNotificationGetGroupedNotificationsRelatedViewsNotFoundPost value)? notFoundPost,TResult? Function( UNotificationGetGroupedNotificationsRelatedViewsPostView value)? postView,TResult? Function( UNotificationGetGroupedNotificationsRelatedViewsStarterPackView value)? starterPackView,TResult? Function( UNotificationGetGroupedNotificationsRelatedViewsUnknown value)? unknown,}){
final _that = this;
switch (_that) {
case UNotificationGetGroupedNotificationsRelatedViewsProfileViewDetailed() when profileViewDetailed != null:
return profileViewDetailed(_that);case UNotificationGetGroupedNotificationsRelatedViewsBlockedPost() when blockedPost != null:
return blockedPost(_that);case UNotificationGetGroupedNotificationsRelatedViewsGeneratorView() when generatorView != null:
return generatorView(_that);case UNotificationGetGroupedNotificationsRelatedViewsNotFoundPost() when notFoundPost != null:
return notFoundPost(_that);case UNotificationGetGroupedNotificationsRelatedViewsPostView() when postView != null:
return postView(_that);case UNotificationGetGroupedNotificationsRelatedViewsStarterPackView() when starterPackView != null:
return starterPackView(_that);case UNotificationGetGroupedNotificationsRelatedViewsUnknown() when unknown != null:
return unknown(_that);case _:
return null;
}
}