Up until now, the apps we discussed were quite simple; there was no real need to design a model. However, when developing more complex (web) applications, a good model to start from will lay a more stable foundation for the code. In this chapter we will build a project from scratch, designing its model graphically, and start implementing it with a framework. The good thing is that we will use tools developed in Dart to do this. Because most of the projects we will develop are hosted on GitHub, we start by looking at how Git and GitHub work. We will cover the following topics:
Git is an open source software tool that allows groups of people to work together harmoniously on the same code project at the same time. So, it's a distributed version control system. The projects are published in the cloud, for example, in the GitHub repository https://github.com/ (there are other websites that accept Git projects, for example, Bitbucket at https://bitbucket.org/). Git maintains local copies of these projects on your computer(s). For this to work, the Git tool must be installed locally as well. To get started, create an account on the GitHub website or sign in if you already have one. Go to the site https://help.github.com/articles/set-up-git and click on the Download and install the latest version of Git link. If necessary, choose your OS and then let the wizard install Git on your machine with the default options. The code from this book resides in the following GitHub repository: https://github.com/Ivo-Balbaert/learning_dart. To create a local copy of the code examples:
/home/git
or d:git
)cd git
git clone git://github.com/Ivo-Balbaert/learning_dart.git
A subfolder learning_dart
is created and then all files are copied in it locally. Afterwards, if you want to get the latest changes from the remote repository, go to the local directory and use the following command:
git pull
This is easy; just follow the steps given here:
dart_projects
. Then click on the Create Repository button (we follow the Dart style guidelines here and name it as a directory: lowercase_with_underscores
). Now, your remote repository is created with the URL https://github.com/your_name/dart_projects.git
.git/dart_projects
. Start Git bash and go to that folder with cd
. git init
README.md
in a simple text editor, and put some useful information in it with Dart Editor (or your favorite text-editor).git add README.md.
In general, the git add
command will put all that is inside the directory into a waiting room (called a staging area or index). The git status
command will show these new changes that are yet to be committed to your project. At this time, you make these changes permanent by committing our project with the following command:
git commit -m 'created first version'
Here, -m
provides a message. You can also provide a text file called gitignore
to contain files (or patterns of files) that are not to be included in the version control system.
git remote add origin https://github.com/your_name /dart_projects.git
and
git push –u origin master
(You will be asked to authenticate with your GitHub username and password).
git add . git commit -m 'verb something' git push
git rm filename
before commit
. You can also indicate a version of your project by giving it a tag, for example, s00: git tag -a s00 -m 'spiral 00'
git push --tags
If you want to invite someone else to join your project in order to make changes, select the repository of your project, use the Settings menu, and then select the
Collaborators option. Add that person by using his or her GitHub name. If you are not alone on your project, you should always start your working session with the git pull
command to get the latest changes and to avoid conflicts. Watch the videos at this link to get a good introduction to Git: http://git-scm.com/videos. Also, the basic concepts are explained in this course: https://www.codeschool.com/courses/try-git.
3.17.174.0