Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ObservableList.sublist does not return an ObservableList #13965

DartBot opened this Issue Oct 10, 2013 · 9 comments


None yet
7 participants

DartBot commented Oct 10, 2013

This issue was originally filed by @butlermatt

This used to work correctly in web_ui, but as I port my project over to Polymer I'm finding that ObservableList.sublist() does not return an ObservableList. I instead have to wrap the return of sublist in toObservable.


// This throws an exception
ObservableList get items {
  if(_itemList.length < NUM_ROWS) return _itemList;
  return _itemList.sublist(0, NUM_ROWS);

Uncaught Error: type 'List' is not a subtype of type 'ObservableList' of 'function result'.

// This works
ObservableList get items {
  if(_itemList.length < NUM_ROWS) return _itemList;
  return toObservable(_itemList.sublist(0, NUM_ROWS));


kasperl commented Oct 14, 2013

Added Area-Polymer, Triaged labels.


sigmundch commented Oct 29, 2013

Added this to the Later milestone.


sigmundch commented Nov 14, 2013

Removed this from the Later milestone.
Added this to the M9 milestone.

Removed this from the M9 milestone.
Added this to the 1.1 milestone.


sigmundch commented Jan 28, 2014

Removed this from the 1.1 milestone.
Added this to the 1.2 milestone.


sigmundch commented Feb 5, 2014

Added Library-Observe label.


anders-sandholm commented Feb 6, 2014

Removed Library-Observe label.
Added Pkg-Observe label.


jmesserly commented May 14, 2014

we generally don't try to preserve observable-ness in all accessors, as that would greatly complicate ObservableList/Map impls. We'd need to know about every sublist, iterable, etc, and propagate change notifications. While it's a very neat idea and I support someone taking it on :-), we don't really have bandwidth. (and Object.observe in JS doesn't support it either, for similar reasons).

OTOH, if we fix https://code.google.com/p/dart/issues/detail?id=16342 it will essentially work again (using dirty checking like Web UI did).

Added NotPlanned label.

@DartBot DartBot added this to the 1.2 milestone May 14, 2014


DartBot commented Jun 5, 2015

This issue has been moved to dart-lang/observe#45.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment