maybeWhen<TResult extends Object?> method
TResult
maybeWhen<TResult extends Object?>(
- TResult $default(
- String id,
- String name,
- String ident,
- String? flespiToken,
- String? modelId,
- Model? model,
- String? protocolId,
- InboundProtocol? protocol,
- Map<
String, dynamic> ? additionalFields, - String? qrCode,
- String? linkQr,
- List<
DeviceCommand> ? commands, - List<
Access> ? access, - DeviceTelemetry? telemetry,
- String? visionProfileId,
- VisionProfile? visionProfile,
- PhoneNumber? phone,
- ModbusConfig? modbus,
- bool? isSuspended,
- HwModel? hwModel,
- String? hwModelId,
- String? macAddress,
- Map<
String, dynamic> ? configParams, - Duration? visionCaptureThreshold,
- List<
Device> ? peripherals, - String? localIpAddress,
- required TResult orElse(),
A variant of when that fallback to an orElse callback.
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return orElse();
}
Implementation
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, String ident, String? flespiToken, String? modelId, Model? model, String? protocolId, InboundProtocol? protocol, Map<String, dynamic>? additionalFields, String? qrCode, String? linkQr, List<DeviceCommand>? commands, List<Access>? access, DeviceTelemetry? telemetry, String? visionProfileId, VisionProfile? visionProfile, PhoneNumber? phone, ModbusConfig? modbus, bool? isSuspended, HwModel? hwModel, String? hwModelId, String? macAddress, Map<String, dynamic>? configParams, @DurationConverter() Duration? visionCaptureThreshold, List<Device>? peripherals, String? localIpAddress)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Device() when $default != null:
return $default(_that.id,_that.name,_that.ident,_that.flespiToken,_that.modelId,_that.model,_that.protocolId,_that.protocol,_that.additionalFields,_that.qrCode,_that.linkQr,_that.commands,_that.access,_that.telemetry,_that.visionProfileId,_that.visionProfile,_that.phone,_that.modbus,_that.isSuspended,_that.hwModel,_that.hwModelId,_that.macAddress,_that.configParams,_that.visionCaptureThreshold,_that.peripherals,_that.localIpAddress);case _:
return orElse();
}
}