arrayPadStart function

Array arrayPadStart(
  1. Array a,
  2. int pad
)

Add zeros at begging of the array

Examples

var list = Array([1,2,3]);

print(arrayPadStart(list, 2));

/* output:
Array([0, 0, 1, 2, 3])
*/

Implementation

Array arrayPadStart(Array a, int pad) {
  var aux = Array.fixed(pad, initialValue: 0);
  return arrayConcat([aux, a]);
}