createSelector1<S, R1, T> function Null safety

Selector<S, T> createSelector1<S, R1, T>(
  1. Selector<S, R1> selector,
  2. T mapFn(
    1. R1,
    2. dynamic
    )
)

Create a selector composed from one other selector.

Creates a memoized selector. The result of the function will only be recomputed when the composed selector returns a new value.

Implementation

Selector<S, T> createSelector1<S, R1, T>(
  Selector<S, R1> selector,
  T Function(R1, dynamic) mapFn,
) {
  final memoized = memo2(mapFn);

  return (S state, dynamic props) {
    return memoized(selector(state, props), props);
  };
}