when method

Widget when(
  1. bool condition
)

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();
}