Consumer<T> typedef

Consumer<T> = void Function(T value)

A function that consumes a value of type T without returning anything.

Useful for triggering side effects like logging or UI updates.

{@tool snippet}

final Consumer<String> printUpper = (value) => print(value.toUpperCase());
printUpper('hello'); // HELLO

{@end-tool}

Implementation

typedef Consumer<T> = void Function(T value);