DataMapper<T, U> typedef

DataMapper<T, U> = U Function(T value)

A function that transforms a value from type T to type U.

Commonly used for mapping values in functional programming.

{@tool snippet}

final DataMapper<String, int> lengthMapper = (s) => s.length;
print(lengthMapper('hello')); // 5

{@end-tool}

Implementation

typedef DataMapper<T, U> = U Function(T value);