Intro (10 Files Merged)
Intro (10 Files Merged)
development
& Flutter
ABOUT ME
● Software Engineer
● 5+ years at company
● https://www.linkedin.com/in/igor-leshkevych/
● Roles and responsibilities:
○ Developer (backend, frontend, mobile)
○ Lead
○ Currently a member of CTO team (company improvements, R&D)
ABOUT “LEOBIT”
● English (pre-inter+)
● Understanding of Git (commit/push/pull)
● Programming experience, preferably with C-like language (C/C++, Java,
JS, C#, etc.)
● Some understanding of mobile platforms (types of devices, Android,
iOS, etc.)
COURSE CONTENT
● 12 weeks = 12 lectures
● Score 0...100 (55 ex + 45 labs)
● Lectures online (at least for now)
HOMEWORK
Умови:
● Підписатись на сторінку Leobit в Instagram
● Підписатись на телеграм канал Leobit Career
● Позначити друга у коментарях під дописом у
Instagram
Intro Q&A
Lecture 1
● https://medium.com/swlh/native-vs-non-native-mobile-apps-whats-
the-difference-b3a641e06f52
● https://dart.dev/overview#platform
What is Flutter
https://semver.org/
Flutter vs others
● Fast development/prototyping
● Pleasant to work with (hot reload, straightforward)
● Is expected to grow (and potentially outgrow React Native with time)
Lecture 1 Q&A
Join Us
Умови:
● Підписатись на сторінку Leobit в Instagram
● Підписатись на телеграм канал Leobit Career
● Позначити друга у коментарях під дописом у
Instagram
UI and Layouts
Lecture 2
● https://flutter.dev/docs/development/ui/layout
● https://flutter.dev/docs/development/ui/widgets-intro
Markup pros/cons:
+ Can be done separately from - More code in total
logic - Hard to make UI and logic
+ Can be done by a separate communicate
person (good for business, as - Another language to learn
HTML is cheaper than JS, for - Developer experience
example)
+ Good tooling (markup preview,
etc.), no need to compile code
to preview layout
Why Flutter doesnt use markup
● Flutter offers hot-reload, so there is no need in markup
preview tooling
● Android/iOS have their own markup (xml/storyboard), so
introducing yet another markup on top of that wouldn’t
work well
● Flutter promotes “rapid development” and using Dart
exclusively is much faster than Dart + markup
● Flutter is very developer-oriented (tries to provide best
developer experience)
Lecture 1 Q&A
Flutter
basics
Lecture 3
● Flutter set up
● Flutter core concepts
○ Widgets
● Declarative vs Imperative approach
Supported platforms
● Windows
● Linux
● MacOS*
● ChromeOS**
https://flutter.dev/docs/development/ui/widgets/layout#Multi-
child%20layout%20widgets
Examples:
Sliver widgets
We skip them for now, but you can read about them here:
https://flutter.dev/docs/development/ui/advanced/slivers
Ctrl + Shift + P
Widget inspector
Android Studio
Declarative vs Imperative
● Declarative - focuses on “what I want” (result)
● Imperative - focuses on “what to do exactly” (process)
● Declarative is always an abstraction, backed by some
imperative code
Example 1
Example 1
● `array.filter` will still use loops, etc. inside, but now it’s hidden from the
developer
● It allows browser to change implementation of `array.filter`
(performance optimization, refactoring, etc.) and your code will use the
benefits of those updates, and still work (abstraction)
● Declarative code is easier to read/understand = maintain (change,
support)
Example 2
https://flutter.dev/docs/cookbook/na
vigation/navigation-basics
Name routes
● Allows associating some
“keys” with some screens
(routes)
● You can then navigate by
route instead of pushing a
widget directly
● Provides abstraction*
● Does not support
parameters
Declarative navigation
● Can be used as an alternative if you more complex routing scenarios
● You don’t need it for basic scenarios, but eventually it will most likely
completely replace imperative navigation (even for simple cases)
● Declarative navigation is just a framework to abstract you from
manually calling push and pop
● https://medium.com/flutter/learning-flutters-new-navigation-and-
routing-system-7c9068155ade
Section summary
● Navigation allows you to use multiple screens and navigate
between them
● Routing allows you to assign routes to pages and navigate
using routes
● Navigation is implemented using a stack, you can push/pop
to change current screen
● There are some additional abstractions (named routes,
declarative routing) but under the hood it is just another way
to do push/pop for you
Flutter framework architecture
● Flutter has a complex internal structure: it consists of
multiple internal components doing different things
● All those components are forming three different levels:
platform level, engine level and framework level
● At this stage you don’t need to know what those
components are and how they work. You only need to
understand some of them, and they will be covered in
further lectures.
● Lowest level layer, responsible for “connecting” your app to native OS
● Provides an entrypoint; coordinates with the underlying operating
system for access to services like rendering surfaces, accessibility, and
input; and manages the message event loop*.
● Engine layer runs on top of embedder. The “core” of a Flutter app is
C/C++ engine
● It provides the low-level implementation of Flutter’s core API, including
graphics (through Skia), text layout, file and network I/O, accessibility
support, plugin architecture, and a Dart runtime and compile toolchain
● Top layer, exclusively Flutter
● Contains all the Flutter libs, core packages
● Contains all built-in widgets
How Flutter draws things
● Imagine a canvas - just a blank space with some width and some
height, consisting of “virtual pixels”
● When you want to draw something - you need to set color for some set
of pixels
● Manipulating pixels is hard, so there are some “basic abstractions”:
lines, rectangles, circles, etc.
● Manipulating basic abstractions is also hard, so there are some high-
level abstractions - widgets
● Widget = just some set of instructions “how to draw me on canvas”
Important
● Flutter doesn’t use UI system that native apps use (provided by
Android/iOS), it sends drawing commands directly to “canvas” which
sits under the hood of those UI systems.
● All Flutter widgets are designed and “drawn” by Flutter team - Flutter
doesn’t use native buttons, styles etc., all Flutter control just look the
same. Consequences:
○ You can use iOS-like controls on Android, and vice versa
○ If iOS updates some controls - you need to wait till Flutter team
updates corresponding Widgets
More reading
● !! Achtung !!: complicated text ahead (don’t recommend reading it
now)
https://flutter.dev/docs/resources/architectural-overview
Section summary
● Flutter is a complex framework, it consists of multiple
modules doing different work on different levels (platform
level, engine level, framework level)
● Most of those modules just “do their job” and you don’t
need to know about them/understand how they work
● With some of them you’ll work closely, so you’ll have to learn
more about them (will be covered later on our lectures)
Lecture Q&A
Application state
Lecture 5
● Concept of application state
● How UI connects to state (in general)
● How UI connects to state in Flutter
Math intro
● First let’s recall what is math function
● f(x) = y, where x - argument, y - result, f - some kind of
transformation, to get from x to y
Example of function
● f(x) = x + 5
● [x = 1, f(x) = 6]
● [x = 2, f(x) = 7]
● [x = 3, f(x) = 8]
● etc.
Next example
● f(x) = Text(x.toString())
● [x = 1, f(x) = Text(‘1’)]
● [x = 2, f(x) = Text(‘2’)]
● [x = 3, f(x) = Text(‘3’)]
● etc.
Next example
If you run the app in SNS mode (enabled by default), all your packages must
support it. If one or more packages doesnt support it, you have to run the
app with SNS disabled:
> flutter run --no-sound-null-safety