# Vertices constructor

Vertices(VertexMode mode, List<Offset> positions, { List<Offset> textureCoordinates, List<Color> colors, List<int> indices })

## Implementation

    Vertices(
      VertexMode mode,
      List<Offset> positions, {
      List<Offset> textureCoordinates,
      List<Color> colors,
      List<int> indices,
    }) : assert(mode != null),
         assert(positions != null) {
      if (textureCoordinates != null && textureCoordinates.length != positions.length)
        throw new ArgumentError('"positions" and "textureCoordinates" lengths must match.');
      if (colors != null && colors.length != positions.length)
        throw new ArgumentError('"positions" and "colors" lengths must match.');
      if (indices != null && indices.any((int i) => i < 0 || i >= positions.length))
        throw new ArgumentError('"indices" values must be valid indices in the positions list.');

      final Float32List encodedPositions = _encodePointList(positions);
      final Float32List encodedTextureCoordinates = (textureCoordinates != null)
        ? _encodePointList(textureCoordinates)
        : null;
      final Int32List encodedColors = colors != null
        ? _encodeColorList(colors)
        : null;
      final Int32List encodedIndices = indices != null
        ? new Int32List.fromList(indices)
        : null;

      _constructor();
      _init(mode.index, encodedPositions, encodedTextureCoordinates, encodedColors, encodedIndices);
    }