maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
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(
int id,
String name,
int suiteID,
List<int> groupIDs,
int? line,
int? column,
String? url,
int? rootLine,
int? rootColumn,
String? rootUrl,
TestMetadata metadata)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _Test() when $default != null:
return $default(
_that.id,
_that.name,
_that.suiteID,
_that.groupIDs,
_that.line,
_that.column,
_that.url,
_that.rootLine,
_that.rootColumn,
_that.rootUrl,
_that.metadata);
case _:
return orElse();
}
}