mapOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? adultContentPref(
- UPreferencesAdultContentPref value
- TResult? contentLabelPref(
- UPreferencesContentLabelPref value
- TResult? savedFeedsPref(
- UPreferencesSavedFeedsPref value
- TResult? savedFeedsPrefV2(
- UPreferencesSavedFeedsPrefV2 value
- TResult? personalDetailsPref(
- UPreferencesPersonalDetailsPref value
- TResult? feedViewPref(
- UPreferencesFeedViewPref value
- TResult? threadViewPref(
- UPreferencesThreadViewPref value
- TResult? interestsPref(
- UPreferencesInterestsPref value
- TResult? mutedWordsPref(
- UPreferencesMutedWordsPref value
- TResult? bskyAppStatePref(
- UPreferencesBskyAppStatePref value
- TResult? labelersPref(
- UPreferencesLabelersPref value
- TResult? postInteractionSettingsPref(
- UPreferencesPostInteractionSettingsPref value
- TResult? verificationPrefs(
- UPreferencesVerificationPrefs value
- TResult? unknown(
- UPreferencesUnknown 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( UPreferencesAdultContentPref value)? adultContentPref,TResult? Function( UPreferencesContentLabelPref value)? contentLabelPref,TResult? Function( UPreferencesSavedFeedsPref value)? savedFeedsPref,TResult? Function( UPreferencesSavedFeedsPrefV2 value)? savedFeedsPrefV2,TResult? Function( UPreferencesPersonalDetailsPref value)? personalDetailsPref,TResult? Function( UPreferencesFeedViewPref value)? feedViewPref,TResult? Function( UPreferencesThreadViewPref value)? threadViewPref,TResult? Function( UPreferencesInterestsPref value)? interestsPref,TResult? Function( UPreferencesMutedWordsPref value)? mutedWordsPref,TResult? Function( UPreferencesHiddenPostsPref value)? hiddenPostsPref,TResult? Function( UPreferencesBskyAppStatePref value)? bskyAppStatePref,TResult? Function( UPreferencesLabelersPref value)? labelersPref,TResult? Function( UPreferencesPostInteractionSettingsPref value)? postInteractionSettingsPref,TResult? Function( UPreferencesVerificationPrefs value)? verificationPrefs,TResult? Function( UPreferencesUnknown value)? unknown,}){
final _that = this;
switch (_that) {
case UPreferencesAdultContentPref() when adultContentPref != null:
return adultContentPref(_that);case UPreferencesContentLabelPref() when contentLabelPref != null:
return contentLabelPref(_that);case UPreferencesSavedFeedsPref() when savedFeedsPref != null:
return savedFeedsPref(_that);case UPreferencesSavedFeedsPrefV2() when savedFeedsPrefV2 != null:
return savedFeedsPrefV2(_that);case UPreferencesPersonalDetailsPref() when personalDetailsPref != null:
return personalDetailsPref(_that);case UPreferencesFeedViewPref() when feedViewPref != null:
return feedViewPref(_that);case UPreferencesThreadViewPref() when threadViewPref != null:
return threadViewPref(_that);case UPreferencesInterestsPref() when interestsPref != null:
return interestsPref(_that);case UPreferencesMutedWordsPref() when mutedWordsPref != null:
return mutedWordsPref(_that);case UPreferencesHiddenPostsPref() when hiddenPostsPref != null:
return hiddenPostsPref(_that);case UPreferencesBskyAppStatePref() when bskyAppStatePref != null:
return bskyAppStatePref(_that);case UPreferencesLabelersPref() when labelersPref != null:
return labelersPref(_that);case UPreferencesPostInteractionSettingsPref() when postInteractionSettingsPref != null:
return postInteractionSettingsPref(_that);case UPreferencesVerificationPrefs() when verificationPrefs != null:
return verificationPrefs(_that);case UPreferencesUnknown() when unknown != null:
return unknown(_that);case _:
return null;
}
}