Data binding with polymer.dart
In the first recipe, we will go through an example that shows the complete mechanics of working with a Polymer component and data binding, and at the same time emphasizes some important best practices to work with polymer.dart. You can find the code in the project bank_terminal
. The app creates an object of class BankAccount
(which can be found in the lib
folder) and populates it with the data that is shown. You can also provide a transaction amount and the balance of the account is updated. This is depicted in the following screenshot:
How to do it...
Perform the following steps to bind data with polymer.dart:
- First, install the
polymer
dependency in your project by addingpolymer: ">=0.11.0 <0.12.0"
to thepubspec.yaml
file. Save the file in the editor and runpub get
from the command line. This has to be accompanied by an import line; inweb\bank_app.dart
, we useimport'package:polymer/polymer.dart';
but also inweb\bank_app.html
...