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( Map<String, VersionConstraint?>? environment, String? publishTo, Uri? repository, Uri? issueTracker, List<String>? topics, String? documentation, String? resolution, Map<String, Dependency>? dependencies)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Catalog() when $default != null:
return $default(_that.environment,_that.publishTo,_that.repository,_that.issueTracker,_that.topics,_that.documentation,_that.resolution,_that.dependencies);case _:
return orElse();
}
}