whenOrNull<TResult extends Object?> method
TResult?
whenOrNull<TResult extends Object?>(
- TResult? $default(
- Glyph glyph,
- VoidCallback? onPressed,
- String? tooltip,
- bool isLoading,
- bool? isSelected,
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( Glyph glyph, VoidCallback? onPressed, String? tooltip, bool isLoading, bool? isSelected)? $default,) {final _that = this;
switch (_that) {
case _IconButtonData() when $default != null:
return $default(_that.glyph,_that.onPressed,_that.tooltip,_that.isLoading,_that.isSelected);case _:
return null;
}
}