ifNotNull<T> static method

void ifNotNull<T>(
  1. T? value,
  2. void action(
    1. T
    )
)

Executes a function if value is not null

Example:

Helpers.ifNotNull(value, (v) => print(v));

Implementation

static void ifNotNull<T>(T? value, void Function(T) action) {
  if (value != null) action(value);
}