mapOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? transfer(
- ParsedSystemTransferInstruction value
- TResult? transferChecked(
- ParsedSystemTransferCheckedInstruction value
- TResult? unsupported(
- ParsedSystemUnsupportedInstruction 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( ParsedSystemTransferInstruction value)? transfer,TResult? Function( ParsedSystemTransferCheckedInstruction value)? transferChecked,TResult? Function( ParsedSystemUnsupportedInstruction value)? unsupported,}){
final _that = this;
switch (_that) {
case ParsedSystemTransferInstruction() when transfer != null:
return transfer(_that);case ParsedSystemTransferCheckedInstruction() when transferChecked != null:
return transferChecked(_that);case ParsedSystemUnsupportedInstruction() when unsupported != null:
return unsupported(_that);case _:
return null;
}
}