whenOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? $default(
- List<
ValidatorApy> apys, - String epoch
- List<
A variant of when that fallback to returning null
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return null;
}
Implementation
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<ValidatorApy> apys, String epoch)? $default,) {final _that = this;
switch (_that) {
case _ValidatorsApys() when $default != null:
return $default(_that.apys,_that.epoch);case _:
return null;
}
}