linspace static method
Generates a sequence of evenly spaced values over a specified interval.
Similar to NumPy's linspace. Returns num samples from start to stop.
If endpoint is true (default), stop is included as the last value.
If endpoint is false, stop is excluded.
Implementation
static Float64List linspace(
double start,
double stop, {
int num = 50,
bool endpoint = true,
}) {
if (num < 2) {
return Float64List.fromList([start]);
}
final out = Float64List(num);
final step = endpoint ? (stop - start) / (num - 1) : (stop - start) / num;
for (int i = 0; i < num; i++) {
out[i] = start + step * i;
}
return out;
}