mapOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? system(
- ParsedInstructionSystem value
- TResult? splToken(
- ParsedInstructionSplToken value
- TResult? memo(
- ParsedInstructionMemo value
- TResult? unsupported(
- ParsedInstructionUnsupported 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( ParsedInstructionSystem value)? system,TResult? Function( ParsedInstructionSplToken value)? splToken,TResult? Function( ParsedInstructionMemo value)? memo,TResult? Function( ParsedInstructionUnsupported value)? unsupported,}){
final _that = this;
switch (_that) {
case ParsedInstructionSystem() when system != null:
return system(_that);case ParsedInstructionSplToken() when splToken != null:
return splToken(_that);case ParsedInstructionMemo() when memo != null:
return memo(_that);case ParsedInstructionUnsupported() when unsupported != null:
return unsupported(_that);case _:
return null;
}
}