The JSON representation of the last model spiral is generated in the Model Concepts tool and then copied to the model.json
file that is placed in the empty travel_impressions
folder of the new app. The project's model code is generated by dartling_gen
; this is step two in our schema. In Run | Manage Launches of Dart Editor, create a dartling_gen.dart
command-line launch pointing to the following script in the dartling_gen
project:
bin/dartling_gen.dart
In the Script arguments, enter the following argument:
--genall projectpath domain model
For the travel_impressions
project, the arguments are as follows:
--genall c:/dart/travel_impressions travel impressions
The arguments are similar for the project path in Linux: /home/dart/travel_impressions
.
The --genall
argument indicates that the complete project will be generated. The c:/dart/travel_impressions
argument replaces the projectpath
parameter—a path to the project's folder that contains the model.json
file. The travel
argument is the domain name and the impressions
argument is the model name. By running the main
function in the bin/dartling_gen.dart
file, a project with its domain and model will be generated in the project
directory. This project contains the doc
, lib
, test
, and web
folders, as well as a pubspec.yaml
file, which specifies that our project is dependent on dartling and dartling_default_app
. In the generated project, the lib
folder has the gen
and travel
(domain) folders. The gen
folder also has the travel
(domain) folder. The travel
folder, both in lib
and gen
, has the impressions
(model) folder. The gen
folder keeps the generic code (not to be edited!) that is to be regenerated when the model changes. However, the travel
subfolder in lib
contains the specific code that is open for changes. The generic code extends the code in dartling, while the specific code extends the generic code.
However, what if the model changes? Then, update the JSON representation of the model in the model.json
file. Regenerate only the lib/gen
directory by giving these arguments:
--gengen projectpath domain model
If you regenerate only the generic code in the lib/gen
folder, you may need to adjust some specific code. When the complete project is generated, the content of the model.json
file is reproduced in the lib/travel/impressions/json/model.dart
file as the content of its travelImpressionsModelJson
variable. This variable, and not the model.json
file, is used in the running of the application. In this way, you may experiment with some minor changes in the model (for example, changing essential attributes) without losing the content of the model.json
file. However, if you want to keep these changes, you should update the JSON file before the next code generation. After the code is generated, the README.md
and travel_impressions_web.html
files are usually updated in a minor way to reflect the project in question. To run the application, the travel_impressions_web.html
web page (in the web/travel/impressions
folder) is selected. If you run the app, it will show two buttons with the Show Travelers and Show Countries text. When these buttons are pushed, they show a grid with dummy data. The two travel_impressions_web
files (.dart
and .html
) are the only web files, in addition to CSS files, in the project. However, they rely on dartling_default_app
. The objective of this application is to validate the model by using its data. The next step is to create this data.
3.144.26.138