remove method

bool remove (
  1. Object? object
)
override

Removes the first occurrence of value from this list.

Returns true if value was in the list, false otherwise.

var parts = ['head', 'shoulders', 'knees', 'toes'];
parts.remove('head'); // true
parts.join(', ');     // 'shoulders, knees, toes'

The method has no effect if value was not in the list.

// Note: 'head' has already been removed.
parts.remove('head'); // false
parts.join(', ');     // 'shoulders, knees, toes'

The list must be growable.

Implementation

bool remove(Object? object) {
  throw new UnsupportedError("Cannot remove from immutable List.");
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-html/ImmutableListMixin/remove.html