Title: The Tragedy of the Commons
1Modelling and Simulation
- The Tragedy of the Commons
2Fast, modern, beautiful apps for Android and iOS
3Why is Flutter different? Whats new and exciting
about Flutter?
4Technology OEM SDKs
Interpreted (JavaScript)
Compiled to native
iOS SDK Android SDK
MVC/MVVM
View
Reactive Views
5Technology WebViews
Interpreted (JavaScript)
Compiled to native
iOS SDK Android SDK Titanium, Cordova, PhoneGap, Ionic, ...
MVC/MVVM
View
Reactive Views
6Technology Reactive Views
Interpreted (JavaScript)
Compiled to native
iOS SDK Android SDK Titanium, Cordova, PhoneGap, Ionic, ...
Flutter React Native
MVC/MVVM
View
Reactive Views
7The Bridge
Services, Events, Widgets
Your app
JavaScript realm
Native realm
? Context Switch ?
8The Bridge
Each realm by itself is blazingly fast. The
performance bottleneck often occurs when we move
from one realm to the other. In order to
architect performant ... apps, we must keep
passes over the bridge to a minimum. https//med
ium.com/_at_talkol/performance-limitations-of-react-n
ative-and-how-to-overcome-them-947630d7f440
9Advantages of reactive views, without a JS bridge
Compiled to native code (not VM) on each platform
Flutter
10Widgets!
11Flutter started as an experiment
12Traditional Layout
Layout rules (CSS properties)
Widgets (HTML elements)
CSS body text-align center
div.column display inline-block div.icon
color green
HTML ltbodygt ltdiv classcolumngt Hello,
World! ltdiv classicongt 9733 lt/divgt
lt/divgt lt/bodygt
13Problems with Traditional Layout
- Global rules applied to virtually any widget
- Lots of layout methods
- box model(s), floats, tables, flexbox,
grid,multiple columns of text, paged media - Developer cannot add new layout methods
- flexbox, grid
- Slow! And typically N-squared(widgets)
14What we discovered
- Most layout is relatively simple
- Text on a scrolling page
- Fixed rectangles whose size and positiondepend
only on the size of the display - Occasionally tables, floats, etc.
- Most layout is local to a subtree of widgets that
uses a single layout model - Simplify and optimize
15Flutters New Architecture
- Flutter provides its own widgets
- Turns layout on its head!
- Widgets are simple and fast
- Everything is a widget
- Full customization and extensibility
16Turn layout on its head!
Flutter new Center(child new
Column(children new Text('Hello,
World!'), new Icon(Icons.star, color
Colors.green) ) )
17Layout widgets (single child)
Padding
Center
Align
Many others, or add new ones
18Layout widgets (multi child)
Row
Column
Stack
ListView
(flexbox)
Grid, Flow, Table, Wrap, ...
19Everything is a widget!
- sliver layout model (scrolling)
- object layout model
- Themes
- Navigation
- Applications
- Create new kinds of widgets or subclass existing
ones
20Flutter layout
- Fast! And linear (most of the time)
- Avoids layout entirely when possible
- Used to implement scrolling!
- Simple
- Whether you are laying out a column of text, a
table, a slide show, a single-page app, or just
centering
21More about Reactive Views
Reactive web views introduced Virtual DOM Virtual
DOM is immutable Rebuilt for every frame
22Virtual DOM (web)
Platform
Compare,Update
App
realDOM
Render
? Virtual DOM
WebView
23Virtual widgets (mobile)
Platform
Compare,Update
App
Render
OEM widgets
? Virtual widgets
Flutter
App
Render
? Widget tree
24Reactive Views in Flutter
- Limits updates to parts that have changed
- Uses structural repainting using compositing
- Bit blit instead of re-rendering
- Fast scrolling
25Dart helps
- Reactive views generate lots of small objects
- Generational garbage collection
- Allocation with single pointer bump
- GC runs fast (no locks), avoids jank and stutter
- Tree shaking compiler
26More reasons Flutter picked Dart
27Structure of Flutter
28Compatibility
- No compat libraries needed
- Android Jelly Bean, iOS 8.0
- Updating widgets?
29Great
Tooling
30Other benefits
- Widget sets
- Android, iOS, Material Design, ltyour brandgt
- Plugins
- Open source (100 committers)
31New and exciting about Flutter?
- Reactive views, no JS bridge
- Fast and smooth compiles AOT to native (ARM)
code - Developer control of widgets and layout
- Beautiful, customizable widgets
- Great developer tools, stateful hot reload
- More performant, more compatibility, more fun
- Single codebase, multiple platforms (!?)
- Customization enables multiple platforms
32A revolutionary app for a revolutionary show
Flutter is an excellent choice for beautiful,
high-performance, brand-driven mobile
experiences.
33What I really like about Flutter, is their
beautiful set of Material Design
widgets. https//medium.com/_at_aubykhan/how-i-buil
t-a-cross-platform-connected-app-in-7-days-93728a9
87424
34Running at 60 fps, user interfaces created with
Flutter perform far better than those created
with other cross-platform development
frameworks. https//code.tutsplus.com/tutorials/
developing-an-android-app-with-flutter--cms-28270
35The UI is butter smooth ... I have never seen
such a smooth Android app Pascal Welsch,
Speaker at Droidcon Berlin
36Coding with Dart and Flutter rekindled the joy I
had when I started with mobile dev way back when
No B.S. https//traversoft.com/blog/2017/08/08
/conference-app-flutter/
37Companion article https//goo.gl/4BaSPx
Hamilton talk at GDD https//youtu.be/prlK_QL_qO
A
DartConf 2018 https//events.dartlang.orgJanuar
y 23-24, Los Angeles
Wm Leler Developer Advocate wmleler_at_google.com
Thanks! Questions?