I can call list.add() which adds at the end but there is no convenient way to add an entry to a specific index which at the same time grows the list.
You can use the insert()
and removeAt()
methods now.
You can use insertRange, it will grow the list when adding new elements.
var list = ["1","3","4"];
list.insertRange(0, 1, "0");
list.insertRange(2, 1, "2");
list.forEach((e) => print(e));
You can try it out on the DartBoard here
Dart 2
var idx = 3;
list.insert(idx, 'foo');
Depends on whether you want to insert a single item or a bunch of items
All available methods https://api.dartlang.org/stable/2.1.0/dart-core/List-class.html#instance-methods
Ok, it seams as if list.insertRange(index, range, [elem]) is what i am looking for.