Maksim Lin www.manichord.com This is not a demo... Topics Quick - - PowerPoint PPT Presentation

maksim lin manichord com this is not a demo topics quick
SMART_READER_LITE
LIVE PREVIEW

Maksim Lin www.manichord.com This is not a demo... Topics Quick - - PowerPoint PPT Presentation

Real world Flutter Maksim Lin www.manichord.com This is not a demo... Topics Quick Intro Dev UX Porting State Management Architecture Project Structure Native Integration Logging / Debugging Monitoring


slide-1
SLIDE 1

Real world Flutter

Maksim Lin

www.manichord.com

slide-2
SLIDE 2

This is not a demo...

slide-3
SLIDE 3

Topics

  • Quick Intro
  • Dev UX
  • Porting
  • State Management
  • Architecture
  • Project Structure
  • Native Integration
  • Logging / Debugging
  • Monitoring Analytics
slide-4
SLIDE 4

What is Flutter?

“Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.”

slide-5
SLIDE 5

Developer UX

  • First platform I have used where vendor

seems to care deeply about: Developer UX

  • a PM for developer ux:
slide-6
SLIDE 6

Developer UX

Even the biggest critics agree…

slide-7
SLIDE 7

Flip, Flop, FLAP

Porting/Integrating existing code-bases

slide-8
SLIDE 8

Google: Add to App

slide-9
SLIDE 9

Maks: FLAP

slide-10
SLIDE 10

Storyboarding

  • Storyboard package: storyboard: ^0.0.4
  • “Container -> Content” widgets architecture
  • Inspired by Storybook for web: React,

Angular, etc

slide-11
SLIDE 11

State management

Use Provider and BLOC’s

  • Be happy and move on! 😊👍
  • Keep all business logic out of widgets, put it

in BLOCs (or anywhere else except widgets!)

  • Pragmatic BLOC: everything doesn't have to

be a stream!

  • If doing “clean architecture” have BLOCs use

services

slide-12
SLIDE 12

State Mgmt: DECOUPLE from Blocs/Providers for generic widgets

Often can just pass in a stream and/or callbacks to actual widget from “container” widget to make easier to reuse and also to storyboard. eg. Yet another idea Flutter “borrowed” from React. Dan Abramov called it: “Presentational and Container Components”

slide-13
SLIDE 13

Project Structure

Just my way, unlike Android (almost) nothing is proscribed by Flutter Top-level:

  • lib/
  • assets/
  • test/
  • docs/
slide-14
SLIDE 14

Project Layout: lib/

  • blocs/
  • debug/
  • localisation/
  • models/
  • plugins/
  • screens/
  • services/
  • style/
  • types/
  • widgets/
slide-15
SLIDE 15

Project Layout: assets/

  • data/
  • fonts/
  • l10n/
  • images

/icons /{screen_name}

  • videos

/{screen_name}

slide-16
SLIDE 16

Native Integration

  • Easiest to do directly without packaging

custom plugins

  • Need to manually initialise
  • eg. for Android:
slide-17
SLIDE 17

Deep Integration: OpenGL

  • Flutter -> Java -> C++
  • Flutter -> ObjC -> C++
  • Oh my! Can it be done?
  • Others paved the way…
slide-18
SLIDE 18

When things go wrong

We as developers spend most of our time with things that have gone wrong...

slide-19
SLIDE 19

Logging

  • Much more useful than with native dev as no

recompile needed

  • Lots to choose from!...

stdout (print), package:logging, dart:developer, 3rd party pkgs

  • Which to use?
  • … print for quick/temporary,
  • … dart:developer
  • Cannot filter or set levels in VS Code or

Devtools 😟

slide-20
SLIDE 20

Debugging all the things...

slide-21
SLIDE 21

Bonus: Network Logging & Debugging

Using Logging:

Not really maintained now 😟

slide-22
SLIDE 22

Bonus: Network Logging & Debugging

Using Proxy (eg. Charles):

slide-23
SLIDE 23

To Fork or not to Fork...

Even first-party plugins can need more functionality (markdown, sentry)

“Fork in the Road” by Curtis Gregory Perry - CC BY-NC-SA 2.0

slide-24
SLIDE 24

Crashlytics: Dont!

  • Crashlytics just painful, poor functionality
  • Use Sentry instead!
  • Flutter docs recommends it over Crashlytics!
  • First-party Sentry package!
  • still under construction - PR incoming for

context support...

slide-25
SLIDE 25

Monitoring: Errors and Analytics

slide-26
SLIDE 26

Thank You!

Questions?

@mklin maks