Core Basics
Flutter includes a modern react-style framework, a 2D rendering engine, ready-made widgets, and development tools. These components work together to help design, build, test, and debug apps. Everything is organised around a few core principles.
π Widgets are the basic building blocks of a Flutter appβs user interface. Unlike other frameworks that separate views, view controllers, layouts, and other properties, Flutter has a consistent, unified object model: the widget that works across the app. π€
π Widgets form a hierarchy based on the composition they work with. Each widget can be nested inside, and inherits properties from its parent. There is no separate βapplicationβ object. Instead, the root widget serves this role & handles the state of the app.
π Flutter and Chrome use the same rendering engine β SKIA. Instead of interacting with native APIs, it controls every pixel on the screen, which gives it the much necessary freedom from the legacy baggage as well as the performance it has.
Some commands I run while setting up Android studio and Flutter on my machine:
1echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile
2 echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.bash_profile
3Supported Commands for update on macOS:
1update sdk -u
2
3Supported commands are:
4android list target
5android list avd
6android list device
7android create avd
8android move avd
9android delete avd
10android list sdk
11android update sdk
121flutter doctor --android-licenses
2π In case you face this error run π
1flutter doctor --android-licenses
2
3ERROR: JAVA_HOME is set to an invalid directory: /usr/libexec/java_home
4
5Please set the JAVA_HOME variable in your environment to match the
6location of your Java installation.
7run the commands: π
1export JAVA_HOME=`/usr/libexec/java_home`
2
3echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile
41brew install android-platform-tools
2Installing Flutter with Homebrew
1brew install --cask flutter
21flutter upgrade
2create a flutter app
step 1: π Navigate to desired folder where you want to locate your app;
1cd development/
2step 2: π Run the command:
1flutter create first_app
21In order to run your application, type:
2
3 $ cd first_app
4 $ flutter run
5
6Your application code is in first_app/lib/main.dart.
7
81
2Flutter run key commands.
3
4r Hot reload. π₯π₯π₯
5R Hot restart.
6h Repeat this help message.
7d Detach (terminate "flutter run" but leave application running).
8c Clear the screen
9q Quit (terminate the application on the device).
10XCode
1
2$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
3$ sudo xcodebuild -license
4$ open -a Simulator
5