Initializing the Travel Impressions model with Data
After the model is designed (refer the Spiral 4 of the Travel Impression Model figure) and its code is generated, the model is 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 with creating a country and some of its places, together with 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, there is no code
attribute of the String
type. The code
attribute is inherited from Dartling. In a concept, you do not need to use the inherited code attribute. However, if you use it, its values must be unique. Note that a new country is added to the...