ifTrue<T> static method

T? ifTrue<T>(
  1. bool condition,
  2. T value()
)

Returns a value if condition is true, otherwise returns null

Example:

Helpers.ifTrue(condition, () => 'value');

Implementation

static T? ifTrue<T>(bool condition, T Function() value) {
  return condition ? value() : null;
}