Lect 2
Lect 2
Flutter
lect2
T\ Sondos Saif
Important command
• flutter doctor
It used to check flutter and its dependcies
• emulator –avd [emulator_name]
It used to run the emulator you already created
• flutter run
It used to run the app you develop on the emulator, to make this command
work you have to go to the directory of the app and then run this command.
2
File Structur
• After creating the flutter project, you will see the following folders:
• android/ and ios/: These folders contain platform-specific code for each OS and
they’re automatically managed by the IDE and the compiler.
• lib/: This folder is essential: it contains the Dart source code of your Flutter app.
You’re going to spend a countless amount of hours in here.
• test/: Unit tests, widget tests and integration tests all go in this folder.
• pubspec.yaml: This file is fundamental as it defines a Dart package and lists
dependencies of your Flutter app.
• README.md: It’s the typical markdown file you can find in any git repository. It’s
used for your git repository and at the same time as "home page" at
https://pub.dev in case you wanted to publish a package.
3
File Structur
• YAML is a data-serialization language commonly used for configuration files. It exposes a series of settings
in a human-readable way; it has no punctuation as it relies on indentation and line breaks.
• version. Any package is required to specify a version number which increments at any release.
• sdk. This section contains the constraints indicating which SDK versions your app supports. The Dart team
recommends to always include a lower and an upper bound but you could simply use ">= 2.7" and it’d be
valid anyway.
• uses-material-design. Ensures that your Flutter app is able to use icons from the Google Material design 3
project. They are pretty common in the Google world, especially in Android as they’re the default icons
being used in many apps.
• dependencies. This is probably the most important label because it declares any package the app is going
to depend on. You just need to go to https://pub.dev, look for a package and add a new line.
dependencies:
flutter:
sdk: flutter
http: ^0.12.2 4
provider: ^4.3.2+2
flutter_svg: ^0.18.1
Hot reload
5
Widgets