applyUnless method

Widget applyUnless(
  1. bool condition,
  2. Widget modifier(
    1. Widget widget
    )
)

Applies a modifier only when condition is false.

The inverse of applyIf.

button.applyUnless(isEnabled, (w) => w.opacity(0.5))

Implementation

Widget applyUnless(bool condition, Widget Function(Widget widget) modifier) {
  return condition ? this : modifier(this);
}