maybeWhen<TResult extends Object?> method
TResult
maybeWhen<TResult extends Object?>(
- TResult $default(
- Color? backgroundColor,
- Color? foregroundColor,
- Color? evenBackgroundColor,
- Color? evenForegroundColor,
- Color? hoverBackgroundColor,
- Color? evenHoverBackgroundColor,
- SelectedTileColor selectedColor,
- TextStyle? textStyle,
- Widget? trailingIcon,
- bool withCheckboxIcon,
- Widget? checkboxIcon,
- Widget? selectedCheckboxIcon,
- 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( Color? backgroundColor, Color? foregroundColor, Color? evenBackgroundColor, Color? evenForegroundColor, Color? hoverBackgroundColor, Color? evenHoverBackgroundColor, SelectedTileColor selectedColor, TextStyle? textStyle, Widget? trailingIcon, bool withCheckboxIcon, Widget? checkboxIcon, Widget? selectedCheckboxIcon)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ListDataTileStyle() when $default != null:
return $default(_that.backgroundColor,_that.foregroundColor,_that.evenBackgroundColor,_that.evenForegroundColor,_that.hoverBackgroundColor,_that.evenHoverBackgroundColor,_that.selectedColor,_that.textStyle,_that.trailingIcon,_that.withCheckboxIcon,_that.checkboxIcon,_that.selectedCheckboxIcon);case _:
return orElse();
}
}