Model Driven View (MDV) is a set of techniques to help you bind data to your views, in a more direct way than we did in Chapter 6, Combining HTML5 Forms with Dart. The idea here is simple:
Data binding can be a one-way (model to view) with or without observing (monitoring) changes in the model: this means data from our model (a variable or a method that returns a value) is shown (read-only) on the page and we do this by writing {{var}}
in the web page and marking the variable var
in code as: @observable var
. When its value changes, the altered value is shown in the web page. In general, you can show any Dart expression with the notation {{ expression }}
, but be careful that the expression doesn...