length property

int length

Returns the number of objects in this list.

The valid indices for a list are 0 through length - 1.

Implementation

@override
int get length {
  _context.enforceReadPolicy(_atom);

  _atom.reportObserved();
  return _list.length;
}
void length= (int value)

Changes the length of this list.

If newLength is greater than the current length, entries are initialized to null.

Throws an UnsupportedError if the list is fixed-length.

Implementation

@override
set length(int value) {
  /// There is no need to enforceWritePolicy since we are conditionally wrapping in an Action.
  _context.conditionallyRunInAction(() {
    _list.length = value;
    _notifyListUpdate(0, null, null);
  }, _atom);
}