whenOrNull<TResult extends Object?> method
TResult?
whenOrNull<TResult extends Object?>(
- TResult? $default(
- String? id,
- double reconnectionPercent,
- int reconnectionMaximum,
- int reconnectionIncidents,
- int maxAssets,
- int maxDevices,
- int maxUsers,
- int maxOutboundServices,
- int maxFunctions,
- int maxApps,
- List<
String> allowedAppsIds, - List<
String> allowedAlgorithmsIds, - List<
String> allowedInboundProtocolsIds, - List<
String> allowedOutboundProtocolsIds, - List<
String> allowedVisionProtocolsIds, - List<
String> allowedExchangeProtocolsIds, - bool aiEnabled,
A variant of when that fallback to returning null
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return null;
}
Implementation
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? id, double reconnectionPercent, int reconnectionMaximum, int reconnectionIncidents, int maxAssets, int maxDevices, int maxUsers, int maxOutboundServices, int maxFunctions, int maxApps, List<String> allowedAppsIds, List<String> allowedAlgorithmsIds, List<String> allowedInboundProtocolsIds, List<String> allowedOutboundProtocolsIds, List<String> allowedVisionProtocolsIds, List<String> allowedExchangeProtocolsIds, bool aiEnabled)? $default,) {final _that = this;
switch (_that) {
case _BillingPlanInput() when $default != null:
return $default(_that.id,_that.reconnectionPercent,_that.reconnectionMaximum,_that.reconnectionIncidents,_that.maxAssets,_that.maxDevices,_that.maxUsers,_that.maxOutboundServices,_that.maxFunctions,_that.maxApps,_that.allowedAppsIds,_that.allowedAlgorithmsIds,_that.allowedInboundProtocolsIds,_that.allowedOutboundProtocolsIds,_that.allowedVisionProtocolsIds,_that.allowedExchangeProtocolsIds,_that.aiEnabled);case _:
return null;
}
}