You are on page 1of 39

Google IO Extended - Minna June 2019

Building with
Flutter
Shuaib Afegbua, @afegbuas
Code Kraft
THE PROMISE
ABOUT ME
Technology enthusiast |> Software craftsman |> Loves building stuff

Long love affair with Java. Also writes Elixir, Scala and some others

• Computer Science major (FUTMINNA and ABU)


• Worked at Mott Macdonald/Cambridge Education for a long time and
some other places
• Got tired, quit and stayed at home.
• Built some stuff later
What is flutter?
Flutter is Google’s portable UI toolkit for building
beautiful, natively-compiled applications for
mobile, web, and desktop from a single
codebase.
- flutter.dev
ANDROID VS NATIVE

APPROACHES
why flutter?
Flutter empowers the developer.
EVERYTHING IS A WIDGET

Awesome UI • Excellent look and feel


Library • Performs very fast
• Extensible and customisable
SINGLE CODE BASE

Write once, •

One language for UI and Backend
Bundled Framework
deploy cross • Mobile
• Web
platform • Desktop
• Embedded devices
EVENT DRIVEN

• JIT
Reactive • AOT
• Isolate and Event stream
• Sub seconds fast reloads
Fast Build • Native android with Gradle takes about 10
seconds
• No bridge
Native • Compiles AOT into Native ARM
• Fast and easy developments
Efficient • Integrate into existing apps
• Excellent build tools and IDE intellisense
Amazing • Growing community
toolsets •

Pub Packages
Cool documentation
How flutter does it!
Image credits: Flutter Team
How to flutter?
Set up is easy and well documented.
https://flutter.dev/docs
flutter create gdg_app

cd gdg_app

open -a simulator

flutter run
Just enough Dart?
Dart is a language optimized for client-side
development for web and mobile. Dart helps you craft
beautiful, high-quality experiences across all screens. A
client-optimized language Rich, powerful frameworks
Delightful, flexible tooling
• Data Types
• Collections
• Functions
• Anonymous and first class functions
Dart • Classes
• Asynchronous programming
• HTTP Programming
• Mixins
• Isolates
The
building
block
A tree of widgets and some other stuff
Stateless Stateful
widgets widgets
just when you get
started ?
Dos and Don’ts.
AVOID • Widgets are easily composable
• Avoid the the temptation of long nested
FAT widgets
CLASSES • Abstract common functionalities to custom
widgets
WIDGETS • Many files has never broken an app
• Care about maintainabilty
SMALL FUNCTIONS • Single responsibility principle
NEVER • Easily testable
• Use ⇒ for short functions and methods
KILLED ANYONE
ADOPT • Take for example state management
“madness”
A • Good old setState() and StatefulWidgets
PATTERN • ScopedModel, Redux, MobX , BLoC
• New school - Provider
ENSURE • Use code formatters – dartformat
• Don’t forget to test and test always
CODE • Do code reviews
CONSISTENCY
• Ensures app quality
TEST OR DIE • Unit test your function, method, or class
• Carry out component test
• Verify app behaviours with Integration tests
• Tools: Package test, mockito
• Superb IDE support VSCODE, IntelliJ
EMBRACE TOOLS • Code completion and Intellisence
• Dartdoc exist
• They got you a guide -
https://dart.dev/guides/language/effective-
DOCUMENTATION dart/documentation#doc-comments
• Avoid useless documentation
• Just save the unfortunate developer that will
inherit your code
A GOOD NAME IS • Meaningful names
BETTER ? • Spell words in identifiers and comments
correctly
• Maybe that package exist
PACKAGES • Growing number of packages
• https://pub.dev is your friend. 2,636 and counting
• We need more. Start building
• Think 3rd party packages before use
• Google is your friend
GETTING HELP • Don’t we all love stackoverflow
• Flutter docs, YouTube, reddit, medium
• Just let it crash
LINKS
• https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
• https://dart.dev/guides/language/effective-dart/documentation#doc-
comments
• https://flutter.dev/docs/testing
• https://medium.com/@afegbua/flutter-thursday-series-
9564d04e63a7

You might also like