Fill method

Pointer<T> Fill(
  1. int count,
  2. X init(
    1. int
    ), {
  3. String? key,
})

Allocates (or reuses) a slot of count elements, populating each index i with the value returned by init(i).

Implementation

Pointer<T> Fill(int count, X Function(int) init, {String? key}) {
  final p = At(_slotKey(key), count);
  for (int i = 0; i < count; i++) indexSetterFunc(p, i, init(i));
  return p;
}