Introduction 1
How to Use This Book 1
Conventions Used in This Book 2
What You Don’t Have to Read 2
Foolish Assumptions 3
How This Book is Organized 4
Part 1, “Getting Ready” 4
Part 2, “Flutter: A Burd’s-Eye View” 4
Part 3, “Details, Details” 4
Part 4, “The Part of Tens” 4
More on the web! 5
Icons Used in This Book 5
Beyond the Book 6
Where to Go from Here 6
Part 1: Getting Ready 7
Chapter 1: What is Flutter? 9
Hardware and Software (Things You May Already Know) 10
Where Does Flutter Fit In? 15
Cross-platform development 15
A quick-and-easy development cycle 17
A great way to think about app development 25
Enough New Terminology! What’s Next? 28
Chapter 2: Setting Up Your Computer for Mobile App Development 29
The Stuff You Need 30
What to Do 32
Getting and installing the stuff 32
For Mac users only 34
Configuring Android Studio 35
Running your first app 36
Dealing with the Devil’s Details 43
On installing Android Studio 43
On launching Android Studio for the first time 44
On installing Android Studio’s Flutter plugin 44
On adding virtual devices 46
On installing Flutter 50
Divisiveness Among Devices 52
Running apps on an Android device 52
Testing apps on a physical device 53
Using Android Studio 59
Starting up 59
The main window 60
Running This Book’s Sample Programs 63
Enjoying reruns 65
If you’re finicky 65
Were These Setup Steps Fun or What? 66
Part 2: Flutter: A Burd’s-Eye View 67
Chapter 3: “Hello” From Flutter 69
First Things First 69
What’s it all about? 72
A constructor’s parameters 75
A note about punctuation 76
Don’t relent — simply indent 77
Classes, Objects, and Widgets 79
A brief treatise on “within-ness” 81
The documentation is your friend 82
Making Things Look Nicer 83
Creating a scaffold 86
Adding visual tweaks 88
Dart’s enum feature 89
Hello from sunny California! 89
Adding another widget 91
Centering the text (Part 1) 94
Centering the text (Part 2) 97
Displaying an image 100
Hey, Wait a Minute 104
Chapter 4: Hello Again 105
Creating and Using a Function 106
The function declaration 107
A function call 108
Parameters and the return value 108
Programming in Dart: The Small Stuff 112
Statements and declarations 112
Dart’s typing feature 113
Literals, variables, and expressions 114
Two for the price of one 117
Dart’s var keyword 119
Built-in types 121
Types that aren’t built-in 123
Using import declarations 123
Variations on a Theme from Die Flutter Mouse 124
Type names in function declarations 127
Naming your parameters 128
What about the build function? 129
More Fun to Come! 130
Chapter 5: Making Things Happen 131
Let’s All Press a Floating Action Button 132
Stateless widgets and stateful widgets 134
Widgets have methods 135
Pay no attention to the framework behind the curtain 139
Enhancing Your App 146
More parameters, please 148
The override annotation 151
What does mean? 152
Anonymous functions 153
What belongs where 156
Names that start with an underscore 160
Whew! 162
Chapter 6: Laying Things Out 163
The Big Picture 164
Creating bite-size pieces of code 167
Creating a parameter list 169
Living color 170
Adding padding 171
Your humble servant, the Column widget 173
The SizedBox widget 175
Your friend, the Container widget 176
Nesting Rows and Columns 181
More Levels of Nesting 183
Using the Expanded Widget 186
Expanded versus unexpanded 189
Expanded widget saves the day 192
Flexing some muscles 196
How Big is My Device? 199
Part 3: Details, Details 205
Chapter 7: Interacting with the User 207
A Simple Switch 208
Dart’s const keyword 211
Compatible or NOT? 213
Wait For It! 214
How Much Do You Love Flutter? 217
Dealing with Text Fields 220
Callouts 1 and 2 223
Callout 3 225
Callout 4 226
Callout 5 230
Creating Radio Buttons 230
Creating an enum 233
Building the radio group 233
Displaying the user’s choice 235
Creating a Dropdown Button 239
Building the dropdown button 242
The little Reset button 244
Making a Map 245
Onward and Upward 246
Chapter 8: Navigation, Lists, and Other Goodies 247
Extending a Dart Class 248
From One Page to Another 251
An icon on a button 254
Pushing and popping 255
Passing Data from Source to Destination 256
Passing Data Back to the Source 261
Dart’s async and await keywords 264
Taking control of the app bar’s Back button 266
Passing Data in Both Directions 267
Creating Named Routes 272
Creating a List 276
The ListView widget 279
Creating list items one-by-one 285
Another new Dart language feature 288
Fetching Data from the Internet 290
Using a public API 293
Sending a URL to a server 295
Making sense of a JSON response 296
What’s Next? 296
Chapter 9: Moving Right Along 297
Setting the Stage for Flutter Animation 297
Moving Along a Straight Line 303
Bouncing Around 308
Animating Size and Color Changes 310
Moving Along a Curve 312
Dragging Things Around 314
Where To Go From Here 319
Part 4: The Part of Tens 321
Chapter 10: Ten Ways to Avoid Mistakes 323
Put Capital Letters Where They Belong 323
Use Parentheses When (and Only When) They’re Appropriate 323
Limit Access to Variables 324
Call setState 324
Make Adjustments for Indices Starting at Zero 324
Use the Expanded Widget 325
Add itemCount to Your ListView.builder 325
Add Imports When They’re Required 325
Declare Assets and Dependencies in pubspec.yaml 325
Indent Your Code According to Dart Language Guidelines 326
Chapter 11: Ten Ways to Enhance Your App Development Career 327
Practice! Practice! 327
Critique Your Own Code 328
Have Others Review Your Code 328
Find Out Which Technologies Your Nearby Companies Use 328
Attend User Group Meetings 328
Ask Questions 329
Ask Yourself Whether You Truly Understand 329
Learn Things That You May Never Need to Know 329
Do What You Love to Do 330
Get Plenty of Sleep 330
Chapter 12: Ten Chapters about Flutter App Development 331
Introduction 331
What is Flutter? 331
Setting Up Your Computer for Mobile App Development 332
‘Hello’ from Flutter 332
Hello Again 332
Making Things Happen 332
Laying Things Out 332
Interacting with the User 332
Navigation, Lists, and Other Goodies 333
Moving Right Along 333
Part 5: Appendices 335
Appendix: Doris’s Dating App 337
Index 347