Flutter in Action
Eric Windmill
  • January 2020
  • ISBN 9781617296147
  • 368 pages
  • printed in black & white

You’ll see how and why to use Flutter the way the Flutter developer community uses it.

From the Foreword by Ray Rischpater, Google
In 2017, consumers downloaded 178 billion apps, and analysts predict growth to 258 billion by 2022. Mobile customers are demanding more—and better—apps, and it’s up to developers like you to write them! Flutter, a revolutionary new cross-platform software development kit created by Google, makes it easier than ever to write secure, high-performance native apps for iOS and Android. Flutter apps are blazingly fast because this open source solution compiles your Dart code to platform-specific programs with no JavaScript bridge! Flutter also supports hot reloading to update changes instantly. And thanks to its built-in widgets and rich motion APIs, Flutter’s apps are not just highly responsive, they’re stunning!

About the Technology

With Flutter, you can build mobile applications using a single, feature-rich SDK that includes everything from a rendering engine to a testing environment. Flutter compiles programs written in Google’s intuitive Dart language to platform-specific code so your iOS and Android games, utilities, and shopping platforms all run like native Java or Swift apps.

About the book

Flutter in Action teaches you to build professional-quality mobile applications using the Flutter SDK and the Dart programming language. You’ll begin with a quick tour of Dart essentials and then dive into engaging, well-described techniques for building beautiful user interfaces using Flutter’s huge collection of built-in widgets. The combination of diagrams, code examples, and annotations makes learning a snap. As you go, you’ll appreciate how the author makes easy reading of complex topics like routing, state management, and async programming.
Table of Contents detailed table of contents

Part 1: Getting to know Flutter and Dart

1 Meet Flutter

1.1 Why Does Flutter Use Dart?

1.2 On Dart

1.3 Who Uses Flutter?

1.4 Who should be using Flutter?

1.4.1 Teams, Project Leads, and CTOs

1.4.2 Individual Developers

1.4.3 Code School Students and Recent CS Grads

1.4.4 Open Source Developers

1.4.5 People Who Value Speed

1.4.6 People Who Are Lazy

1.4.7 People Who Value Control

1.5 Who is This Book For?

1.6 Other Mobile Development Options

1.6.1 Native Development (iOS and Android)

1.6.2 Cross-Platform JavaScript Options

1.7 The Immediate Benefits of Flutter

1.7.1 No JavaScript Bridge

1.7.2 Compile Time

1.7.3 Write Once, Test Once, Deploy Everywhere

1.7.4 Code Sharing

1.7.5 Productivity and Collaboration

1.7.6 Code Maintenance

1.7.7 The Bottom Line: Is Flutter for You?

1.8 Future benefits of Flutter: Web apps and desktop apps

1.9 A brief intro to how Flutter works

1.9.1 Everything is A Widget

1.9.2 Composing UI with Widgets

1.9.3 Widget Types

1.10 Flutter rendering: Under the hood

1.10.1 Compose the Widget Tree and Layout

1.10.2 Composite step

1.10.3 Paint to the screen

1.11 Final note

Summary

2 A brief intro to Dart

2.1 Hello, Dart!

2.1.1 Anatomy of a Dart Program

2.1.2 Add more greetings

2.1.3 I/O and Dart Libraries

2.2 Common programming concepts in Dart

2.2.1 Intro to Dart’s Type System

2.2.2 Comments

2.2.3 Variables and Assignment

2.2.4 Operators

2.2.5 Null Aware Operators

2.3 Control flow

2.3.1 if and else

2.3.2 switch and case

2.3.3 Advanced Switch usage

2.3.4 Loops

2.4 Functions

2.4.1 Anatomy of a Dart Function

2.4.2 Parameters

2.4.3 Default parameter values

2.4.4 Advanced Function Concepts

2.4.5 Lexical Scope

2.5 Object-oriented programming (in Dart)

2.5.1 Classes

2.5.2 Constructors

2.5.3 Inheritance

2.5.4 Factories and Named Constructors

2.5.5 Enumerators

Summary

3 Breaking into Flutter

3.1 Intro to the counter app

3.1.1 Flutter project structure

3.1.2 Anatomy of a Flutter App

3.1.3 Again, "Everything is a Widget"

3.1.4 The build method

3.1.5 new and const constructors in Flutter

3.1.6 Hot Reload

3.1.6 Hot Reload

3.2 Widgets: The widget tree, widget types and the State object

3.2.1 Stateless Widget

3.2.2 Stateful Widget

3.2.3 setState

3.2.4 initState

3.3 BuildContext

3.4 Enhancing the Counter app with the most important widgets

3.4.1 Raised Button

3.5 Favor composition in Flutter (over inheritance)

3.5.1 What is composition?

3.5.2 An example of composition in Flutter

3.6 Intro to Layout in Flutter

3.6.1 Row and Column

3.6.2 Layout Constraints in Flutter

3.6.3 RenderObject

3.6.4 RenderObject and Constraints

3.6.5 RenderBoxes and layout errors

3.6.6 Multi-child widgets

3.6.7 Icons and the FloatingActionButton

3.6.8 Images

3.6.9 Container Widget

3.7 The Element tree

3.7.1 Elements and Widgets

3.7.2 Exploring the element tree with an example

3.7.3 The element tree and state objects

3.7.4 widget keys

3.8 A final note

Summary

Part 2: Flutter user interaction, styles, and animations

4 Flutter UI: Important widgets, themes, and layout

4.1 Setting up and configuring a Flutter app

4.1.1 Configuration: pubspec and main.dart

4.1.2 SystemChrome

4.2 Structural widgets and more configuration

4.2.1 MaterialApp widget

4.2.2 Scaffold

4.2.3 AppBar and PreferredSizeWidget

4.3 Styling and themes in Flutter

4.3.1 Theme

4.3.2 MediaQuery and the of method

4.3.3 ScreenAwareSize method

4.4 Common layout and UI widgets

4.4.1 Stack

4.4.2 Table

4.4.3 TabBar

4.5 ListView and builders

Summary

5 User interaction: Forms and gestures

5.1 User interaction and gestures

5.1.1 The GestureDetector widget

5.1.2 The GestureDetector in practice

5.1.3 Dismissible

5.2 Flutter forms

5.2.1 The Form widget

5.2.2 GlobalKey<FormState>

5.3 FormField widgets

5.3.1 TextFormField

5.3.2 DropdownFormButton

5.3.3 Generic Form Fields

5.4 Form UI and working with focus nodes

5.4.1 InputDecoration

5.4.2 Improve UI with FocusNodes

5.5 Managing form state with form methods

5.5.1 Form.onChange

5.5.2 FormState.save

5.5.3 Form.onWillPop

Summary

6 Pushing pixels: Flutter animations and using the canvas

6.1 Introducing Flutter Animations

6.1.1 Tweens

6.1.2 Animation Curves

6.1.3 Ticker providers

6.1.4 AnimationController

6.1.5 AnimatedWidget

6.1.6 Implementing the AnimationController and Tween for the background

6.2 CustomPainter and the canvas

6.2.1 The shapes used to make up the clouds

6.2.2 Define the CustomPainter and Paint object

6.2.3 CustomPainter paint method

6.3 Staggered animations, TweenSequence, and built-in animations

6.3.1 Creating a custom animation state class

6.3.2 Built in animation widgets: SlideTransition

6.3.3 Building animations for the Clouds widget

6.3.4 TweenSequence

6.4 Reusable custom color transition widgets

Summary

Part 3: State management and asynchronous Dart

7 Flutter routing in depth

7.1 Routing in Flutter

7.1.1 The Farmers Market app

7.1.2 The app source code

7.2 Declarative routing and named routes

7.2.1 Declaring routes

7.2.2 MaterialDrawer widget and a the full menu

7.2.3 Menu items and the appropriate widgets: ListView and ListItems

7.2.4 NavigatorObserver: Highlight active route with RouteAware

7.3 Routing on the fly

7.3.1 MaterialRouteBuilder

7.3.2 showSnackBar, showBottomSheet and the like

7.4 Routing animations

Summary

8 Flutter state management

8.1 Deep Dive into StatefulWidget

8.1.1 The Widget Tree and the Element Tree

8.1.2 The StatefulWidget Lifecycle and When to Do What

8.2 Pure Flutter state management: The InheritedWidget

8.2.1 Creating a Central Store wth an InheritedWidget + StatefulWidget team

8.2.2 The 'inheritFromWidgetOfExactType' and 'of' methods

8.2.3 Use the of method to lift state up

8.2.4 State management patterns beyond Flutter

8.3 Blocs: Business Logic Components

8.3.1 Blocs. How do they work?

8.3.2 Implementing the Bloc architecture

8.3.3 Intro to Streams and Async Dart

8.3.4 Implementing Streams in the CartBloc

Summary

9 Async Dart and Flutter and infinite scrolling

9.1 Async Dart

9.1.1 Future Recap

9.1.2 async / await

9.1.3 Catching errors with Futures

9.1.4 Catching errors with try and catch

9.2 Sinks and streams (and StreamControllers)

9.2.1 The pieces of the observer patter

9.2.2 Implementing streams

9.2.3 Broadcast streams

9.2.4 Higher Order Streams

9.3 Using streams in blocs

9.3.1 Blocs use "inputs" and "outputs"

9.3.2 Implementing a bloc input

9.4 Async Flutter: StreamBuilder

9.5 Infinite and custom scrollable widgets

9.5.1 CustomScrollView and Slivers

9.5.2 CatalogWidget scroll view

9.5.3 Delegates

9.5.4 Custom sliver

Summary

Part 4: Beyond foundations

10 Working with data: HTTP, Firestore, and JSON

10.1 HTTP and Flutter

10.1.1 HTTP package

10.1.2 GET request

10.2 JSON Serialization

10.2.1 Manual Serialization

10.2.2 Auto generated Json serialization

10.2.3 Updating the Todo class

10.2.4 Bring it all together in the UI

10.3 Working with Firebase in Flutter

10.3.1 Installing Firestore

10.3.2 Create a Firestore project

10.3.3 Configure your app

10.3.4 Add Firebase to your pubspec

10.3.5 Using Firestore

10.4 Dependency Injection

10.4.1 Dependency Injection in the app

Summary

11 Testing Flutter Apps

11.1 Tests in Flutter

11.1.1 Setup for Dart Unit tests

11.1.2 Writing Dart unit tests

11.1.3 Using Mockito to test methods that need external dependencies

11.1.4 Flutter widget tests

11.1.5 Flutter integration tests

11.1.6 Performance profiling integration tests

11.2 Accessibility with the semantics widgets

11.3 Next steps with Flutter

Summary

Appendixes

Appendix A: Installation: Dart2

A.1 Installation: Dart2

A.1.1 Mac OS

A.1.2 Windows OS

A.1.3 Linux

A.2 Installation: Flutter SDK

A.2.1 Mac OS

A.2.2 Windows

A.2.3 Linux

A.3 Tooling and a quick note on text editors

A.4 DartPad

Appendix B: Pub package manager

B.1 Hosted packages and versioning with Pub

B.2 Using packages on your machine or from GitHub

B.2.1 Git

B.2.2 Local packages

B.3 Using the packages

Appendix C: Flutter for web developers

C.1 The good news, first

C.2 How is layout handled in Flutter? Is there a flexbox equivalent?

C.3 What about using an absolute position?

C.4 What about the basics: Borders, padding, margin, and color?

C.5 Manipulating text style

C.6 Global styles

Appendix D: Flutter for iOS developers

D.1 What’s the equivalent of UIView in Flutter?

D.2 What’s the paradigm or mental model difference?

D.3 Can I build an app that uses iOS design patterns?

D.4 How to I make complex layouts like UITableView?

D.5 What’s similar to Storyboard?

D.6 How do you draw to the screen?

D.7 How do I add dependencies (like Cocoa Pods)?

D.8 How do I interact with the device and use native APIs?

D.9 Is there an equivalent to CoreData?

Appendix E: Flutter for Android developers

E.1 What’s the equivalent of a view in Flutter?

E.2 What’s the paradigm or mental model difference?

E.3 Where’s the XML layout file?

E.4 How do I draw to the screen?

E.5 What’’s the equivalent of an intent in Flutter?

E.6 What’s the equivalent of runOnUiThread() in Flutter?

E.7 What’s the equivalent of a Gradle file? How do I add dependencies?

E.8 What’s the equivalent of a LinearLayout? What about ScrollView?

E.9 How do I access shared preferences or SQLite?

What's inside

  • Understanding the Flutter approach to the UI
  • All the Dart you need to get started
  • Creating custom animations
  • Testing and debugging

About the reader

You’ll need basic web or mobile app development skills.

About the author

Eric Windmill is a professional Dart developer and a contributor to open-source Flutter projects. His work is featured on the Flutter Showcase page.

We interviewed Eric as a part of our Six Questions series. Check it out here.


placing your order...

Don't refresh or navigate away from the page.
print book $29.99 $49.99 pBook + eBook + liveBook
Additional shipping charges may apply
Flutter in Action (print book) added to cart
continue shopping
go to cart

eBook $31.99 $39.99 3 formats + liveBook
Flutter in Action (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks