when<TResult extends Object?> method
TResult
when<TResult extends Object?>(
- TResult $default(
- VoDashboardPane? currentPane,
- List<
VoDashboardPane> dockPanes, - List<
VoDashboardPane> drawerPanes, - List<
VoDashboardPane> endDrawerPanes, - List<
VoDashboardPane> registry, - List<
VoPage> flowPages, - bool canPopShell,
- bool isInitialized,
A switch-like method, using callbacks.
As opposed to map, this offers destructuring.
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case Subclass2(:final field2):
return ...;
}
Implementation
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( VoDashboardPane? currentPane, List<VoDashboardPane> dockPanes, List<VoDashboardPane> drawerPanes, List<VoDashboardPane> endDrawerPanes, List<VoDashboardPane> registry, List<VoPage> flowPages, bool canPopShell, bool isInitialized) $default,) {final _that = this;
switch (_that) {
case _VoDashboardState():
return $default(_that.currentPane,_that.dockPanes,_that.drawerPanes,_that.endDrawerPanes,_that.registry,_that.flowPages,_that.canPopShell,_that.isInitialized);case _:
throw StateError('Unexpected subclass');
}
}