getDistanceToActualBaseline method

  1. @protected
  2. @mustCallSuper
double getDistanceToActualBaseline (
  1. TextBaseline baseline
)
@mustCallSuper, @protected, inherited

Calls computeDistanceToActualBaseline and caches the result.

This function must only be called from getDistanceToBaseline and computeDistanceToActualBaseline. Do not call this function directly from outside those two methods.

Implementation

@protected
@mustCallSuper
double getDistanceToActualBaseline(TextBaseline baseline) {
  assert(_debugDoingBaseline, 'Please see the documentation for computeDistanceToActualBaseline for the required calling conventions of this method.');
  _cachedBaselines ??= <TextBaseline, double>{};
  _cachedBaselines.putIfAbsent(baseline, () => computeDistanceToActualBaseline(baseline));
  return _cachedBaselines[baseline];
}