ones method

List ones(
  1. int row,
  2. int cols
)

Return a new array of given shape, with ones

var ones = m2d.ones(3,3);
print(ones);
//[[1, 1, 1], [1, 1, 1], [1, 1, 1]]

Implementation

List ones(int row, int cols) =>
    List.filled(row, 1).map((e) => List.filled(cols, 1)).toList();