midwayInsertionIndex method

int midwayInsertionIndex()

if you just want to insert between the nearest two elements, this is the index you want to insert into the array at. If you're moving something that is itself already in the list, we recommend that you use the below method instead

Implementation

int midwayInsertionIndex() => index + (insertingAfter ? 1 : 0);