Flutter BasicsπŸš€

February 12, 2021

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
3

Supported 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
12
1flutter 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.
7

run the commands: πŸ‘‡

1export JAVA_HOME=`/usr/libexec/java_home`
2
3echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile
4
1brew install android-platform-tools
2

Installing Flutter with Homebrew

1brew install --cask flutter
2
1flutter upgrade
2

create a flutter app

step 1: πŸ‘‰ Navigate to desired folder where you want to locate your app;

1cd development/
2

step 2: πŸ‘‰ Run the command:

1flutter create first_app
2
1In 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
8
1
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).
10

XCode

1
2$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
3$ sudo xcodebuild -license
4$ open -a Simulator
5
Chat Avatar