mapOrNull<TResult extends Object?> method
TResult?
mapOrNull<TResult extends Object?>({
- TResult? permissionNotGranted(
- _permissionNotGranted value
- TResult? bluetoothNotSupported(
- _bluetoothNotSupported value
- TResult? scanningError(
- _scanningError value
- TResult? authenticationError(
- _authenticationError value
- TResult? stateError(
- _stateError value
- TResult? measurmentError(
- _measurmentError value
- TResult? connectionError(
- _connectionError value
- TResult? startMeasurementError(
- _startMeasurementError value
- TResult? stopMeasurementError(
- _stopMeasurementError value
- TResult? fetchMeasurementError(
- _fetchMeasurementError value
- TResult? stopFetchMeasurementError(
- _stopFetchMeasurementError value
- TResult? identifyBlinkError(
- _identifyBlinkError value
- TResult? dfuBootloaderError(
- _dfuBootloaderError value
- TResult? commandError(
- _commandError 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( _permissionNotGranted value)? permissionNotGranted,TResult? Function( _bluetoothNotSupported value)? bluetoothNotSupported,TResult? Function( _scanningError value)? scanningError,TResult? Function( _authenticationError value)? authenticationError,TResult? Function( _stateError value)? stateError,TResult? Function( _measurmentError value)? measurmentError,TResult? Function( _connectionError value)? connectionError,TResult? Function( _startMeasurementError value)? startMeasurementError,TResult? Function( _stopMeasurementError value)? stopMeasurementError,TResult? Function( _fetchMeasurementError value)? fetchMeasurementError,TResult? Function( _stopFetchMeasurementError value)? stopFetchMeasurementError,TResult? Function( _identifyBlinkError value)? identifyBlinkError,TResult? Function( _dfuBootloaderError value)? dfuBootloaderError,TResult? Function( _commandError value)? commandError,}){
final _that = this;
switch (_that) {
case _permissionNotGranted() when permissionNotGranted != null:
return permissionNotGranted(_that);case _bluetoothNotSupported() when bluetoothNotSupported != null:
return bluetoothNotSupported(_that);case _scanningError() when scanningError != null:
return scanningError(_that);case _authenticationError() when authenticationError != null:
return authenticationError(_that);case _stateError() when stateError != null:
return stateError(_that);case _measurmentError() when measurmentError != null:
return measurmentError(_that);case _connectionError() when connectionError != null:
return connectionError(_that);case _startMeasurementError() when startMeasurementError != null:
return startMeasurementError(_that);case _stopMeasurementError() when stopMeasurementError != null:
return stopMeasurementError(_that);case _fetchMeasurementError() when fetchMeasurementError != null:
return fetchMeasurementError(_that);case _stopFetchMeasurementError() when stopFetchMeasurementError != null:
return stopFetchMeasurementError(_that);case _identifyBlinkError() when identifyBlinkError != null:
return identifyBlinkError(_that);case _dfuBootloaderError() when dfuBootloaderError != null:
return dfuBootloaderError(_that);case _commandError() when commandError != null:
return commandError(_that);case _:
return null;
}
}