moveToTop method

void moveToTop(
  1. int index
)

Move the element at index to top of the stack

Implementation

void moveToTop(int index) {
var item = _list.removeAt(_list.length - index -1);
_list.add(item);
  }