Dimensions.copy constructor

Dimensions.copy(
  1. Dimensions d2, {
  2. bool includeTypeHint = true,
})

Creates a Dimensions object by copying an existing Dimensions object.

This is a deep copy that clones the internal _dimensionMap HashMap object (which in turn contains only immutable objects of classes String and num).

Any type hint is preserved by default but can be cleared by setting includeTypeHint to false.

Implementation

Dimensions.copy(Dimensions d2, {bool includeTypeHint = true})
    : _dimensionMap = Map<String, num>.from(d2._dimensionMap),
      qType = includeTypeHint ? d2.qType : null;