maybeWhen<TResult extends Object?> method

  1. @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
  1. TResult $default(
    1. String transactionHash,
    2. BigInt? transactionIndex,
    3. String? blockHash,
    4. BigInt? blockNumber,
    5. BigInt gasUsed,
    6. String effectiveGasPrice,
    7. BigInt? blobGasUsed,
    8. String? blobGasPrice,
    9. String from,
    10. String? to,
    11. String? contractAddress,
    )?, {
  2. 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 transactionHash,  BigInt? transactionIndex,  String? blockHash,  BigInt? blockNumber,  BigInt gasUsed,  String effectiveGasPrice,  BigInt? blobGasUsed,  String? blobGasPrice,  String from,  String? to,  String? contractAddress)?  $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _TransactionReceiptCompat() when $default != null:
return $default(_that.transactionHash,_that.transactionIndex,_that.blockHash,_that.blockNumber,_that.gasUsed,_that.effectiveGasPrice,_that.blobGasUsed,_that.blobGasPrice,_that.from,_that.to,_that.contractAddress);case _:
  return orElse();

}
}