gridPoints method

List<num> gridPoints(
  1. num start,
  2. num end,
  3. int levels
)

Returns the equidistant grid points of a discrete interval. The first point coincides with start, the last one with end.

Implementation

List<num> gridPoints(num start, num end, int levels) {
  final left = min(start, end);
  final right = max(start, end);
  final dx = (right - left) / (levels - 1);
  return List<num>.generate(levels, (index) => start + index * dx);
}