core-elements
core-elements copied to clipboard
core-list-dart does not support a list of String as data
I'm using a ObservableList of String as data field for the core-list-element but I'm getting this exception:
Exception: Uncaught Error: Illegal argument(s): first
Stack Trace:
#0 Expando._checkType (dart:core-patch/expando_patch.dart:134)
#1 Expando.[] (dart:core-patch/expando_patch.dart:14)
#2 CoreList.updateItem (package:core_elements/core_list_dart.dart:256:24)
#3 CoreList.refresh (package:core_elements/core_list_dart.dart:317:24)
#4 CoreList.initializeItems (package:core_elements/core_list_dart.dart:245:17)
#5 CoreList.initializeData.<anonymous closure> (package:core_elements/core_list_dart.dart:227:56)
#6 _RootZone.runUnary (dart:async/zone.dart:1151)
#7 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:496)
#8 _Future._propagateToListeners (dart:async/future_impl.dart:579)
#9 _Future._completeWithValue (dart:async/future_impl.dart:339)
#10 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:401)
#11 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#12 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#13 _handleMutation (dart:html:40489)
Where "first" is the first element of the list:
ObservableList data = new ObservableList.from(["first"]);
Thanks for the bug report. Indeed the core-list-dart implementation is using an expando on the data and we assumed that was OK. Turns out that expandos can't be used on numbers and strings, so we need to do something special here.
Meanwhile, the easiest way to work around this limitation is to wrap the strings in an intermediate object.