Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

core-list-dart does not support a list of String as data #138

Open
fedy2 opened this issue Nov 4, 2014 · 1 comment
Open

core-list-dart does not support a list of String as data #138

fedy2 opened this issue Nov 4, 2014 · 1 comment

Comments

@fedy2
Copy link

fedy2 commented Nov 4, 2014

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"]);
@sigmundch
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants