bindMethodCached method

Callable bindMethodCached(
  1. InterpretedFunction method
)

Returns the bound tear-off of method for this instance, allocating it once and reusing it on subsequent accesses. See _boundMethodCache.

Implementation

Callable bindMethodCached(InterpretedFunction method) {
  final cache = _boundMethodCache ??= Map<InterpretedFunction, Callable>.identity();
  return cache.putIfAbsent(method, () => method.bind(this));
}