getContextMap method

Map<String, dynamic> getContextMap()

Gets a context Map from the pool or creates a new one

Implementation

Map<String, dynamic> getContextMap() {
  Map<String, dynamic> map;

  if (_contextMapPool.isNotEmpty) {
    map = _contextMapPool.removeFirst();
    _contextMapReuses++;

    // Clear the map
    map.clear();
  } else {
    map = <String, dynamic>{};
    _contextMapAllocations++;
  }

  return map;
}