List<int> myList = [1,2,3];
int i = 2;
myList[i] = 4; // myList = [1,2,4]
but what if i don't know whether myList contains data at specific index? Then it gives me range error.
i = 4;
myList[i] = 4 // range error
if(myList[i] != null) myList[i] = 4 //range error
myList.insert(i, 4) // i want to replace, not shift values.
Is the only way to replace the list value at specific index is by checking the whole list length first?