DimensionedWorld.make constructor

DimensionedWorld.make(
  1. GridWorld w, {
  2. int lineWidth = 1,
  3. int cellWidth = 3,
})

Make a DimensionedWorld.

Implementation

factory DimensionedWorld.make(GridWorld w,
    {int lineWidth = 1, int cellWidth = 3}) {
  assert(cellWidth > 0, 'cellWidth must be > zero');
  assert(lineWidth > 0, 'lineWidth must be > zero');
  final cellSize = _makeCellSize(cellWidth);
  // worldSize gets used a lot, so caching it as a precomputed Size.
  final worldSize = _makeWorldSize(w, lineWidth, cellWidth);
  return DimensionedWorld._(
    w,
    lineWidth,
    cellWidth,
    cellSize,
    worldSize,
  );
}