box<T> method

Box<T> box<T>()

Returns a cached Box instance.

Implementation

@pragma('vm:prefer-inline')
Box<T> box<T>() {
  /// Note: see benchmark/bin/basics.dart BoxAccess* - HashMap is the winner.
  if (!_boxes.containsKey(T)) {
    return _boxes[T] = InternalBoxAccess.create<T>(this, _entityDef());
  }
  return _boxes[T] as Box<T>;
}