PropertyLerp<T> typedef

PropertyLerp<T> = T? Function(T? a, T? b, double t)

A function type that interpolates between two values of type T.

The function takes two nullable values a and b, and a progress value t (typically between 0 and 1), and returns the interpolated value.

Parameters

  • a - The starting value. If null, the function may return null.
  • b - The ending value. If null, the function may return null.
  • t - The interpolation progress, typically in the range 0.0, 1.0 where 0.0 represents the start (a) and 1.0 represents the end (b).

Returns

The interpolated value between a and b, or null if either input is null.

Example

PropertyLerp<double> doubleLerp = (a, b, t) {
  if (a == null || b == null) return null;
  return a + (b - a) * t;
};

final result = doubleLerp(0.0, 100.0, 0.5); // Returns 50.0

Implementation

typedef PropertyLerp<T> = T? Function(T? a, T? b, double t);