call method

V call(
  1. A1 a1,
  2. A2 a2,
  3. A3 a3,
  4. A4 a4
)

Calls the wrapped computation with the provided arguments a1, a2, a3 and a4.

If a cached value for the given pair of arguments (a1, a2, a3, a4) exists, it will return that value. Otherwise, it computes the value using the provided computation, caches the result for subsequent calls with the same arguments, and then returns the computed value.

The cache uses the pair (a1, a2, a3, a4) as the key to retrieve stored results.

Implementation

V call(A1 a1, A2 a2, A3 a3, A4 a4) {
  final tuple = (a1, a2, a3, a4);
  final cachedValue = _cache[tuple];
  return cachedValue ?? (_cache[tuple] = _body(a1, a2, a3, a4));
}