when method
Returns this widget if condition is true, otherwise returns SizedBox.shrink().
Usage: Text('Hello').when(isVisible)
Implementation
Widget when(bool condition) {
if (condition) return this;
return const SizedBox.shrink();
}
Returns this widget if condition is true, otherwise returns SizedBox.shrink().
Usage: Text('Hello').when(isVisible)
Widget when(bool condition) {
if (condition) return this;
return const SizedBox.shrink();
}