O'Reilly logo

Learning Dart - Second Edition by Ivo Balbaert

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Initializing the Travel Impressions model with data

After the model is designed (refer to the spiral 4 of the Travel Impression Model figure) and its code is generated, the model will be initialized with some basic data starting with its entries. This is done in the lib/travel/impressions/init.dart file:

initTravelImpressions(var entries) {
  _initCountries(entries);
  _initTravelers(entries);
}

We will start by creating a country and some of its places, together with the web links, from the entries parameter:

_initCountries(var entries) {
  var countries = entries.countries;
  var country = new Country(countries.concept);
  country.code = 'BA';
  country.name = 'Bosnia and Herzegovina';
  countries.add(country);

In the Country concept of the graphical model, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required