Making a Map or a List observable in Web UI
问题 I can make a String or a num type observable by using the @observable declaration in the Dart code: @observable var x = ''; and {{ }} syntax in the html: <div>x = {{x}}</div> But @observable does not work with Lists and Maps. How do I make those observable? 回答1: Use toObservable() with the List or Map as an argument. This creates a binding between the List or Map object and its representation in the UI. The following example uses toObservable() . Notice that the List and Map objects have data