mapOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? apiKey(
- SecuritySchemeApiKey value
- TResult? http(
- SecuritySchemeHttp value
- TResult? mutualTLS(
- SecuritySchemeMutualTLS value
- TResult? oauth2(
- SecuritySchemeOauth2 value
- TResult? openIdConnect(
- SecuritySchemeOpenIdConnect 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( SecuritySchemeApiKey value)? apiKey,TResult? Function( SecuritySchemeHttp value)? http,TResult? Function( SecuritySchemeMutualTLS value)? mutualTLS,TResult? Function( SecuritySchemeOauth2 value)? oauth2,TResult? Function( SecuritySchemeOpenIdConnect value)? openIdConnect,}){
final _that = this;
switch (_that) {
case SecuritySchemeApiKey() when apiKey != null:
return apiKey(_that);case SecuritySchemeHttp() when http != null:
return http(_that);case SecuritySchemeMutualTLS() when mutualTLS != null:
return mutualTLS(_that);case SecuritySchemeOauth2() when oauth2 != null:
return oauth2(_that);case SecuritySchemeOpenIdConnect() when openIdConnect != null:
return openIdConnect(_that);case _:
return null;
}
}