clear method Null safety

void clear()

Implementation

void clear() {
  var length = this.length;
  for (var i = 0; i < length; i++) {
    _removeAt(i);
  }
}