Index
Symbols
- @ (at-sign), 151
- \ (backslash character), 93
- $ (dollar sign), 126
- => (fat arrow) notation, 127
- ∞ (infinity symbol), 315
- + (plus sign), 94
A
-
abs
method, 228 - abstract class, 138
- abstract method, 138
- access modifiers, 161
-
Account
class, 228 - adding
- ahead-of-time (AOT) compiler, 22
-
alignment
parameter, 177 - Android
- Android devices
- Android runtime (ART), 12
- Android Studio
- Android Studio IDE, 30, 33
- Android Virtual Devices (AVD)
- angle brackets, 152
- animation
-
Animation
class, 300 -
AnimationController
, 301, 306 - annotation,
override
, 151–152 - anonymous functions, 153–156
- AOT (ahead-of-time) compiler, 22
- Apache Cordova, 19
- API (application programming interface)
- app bar, controlling Back button of, 266–267
- application programming interface (API)
- application programs, 12
-
Application
widget, 26 - apps
- development of, 25–28
- enhancing, 146–162
- mobile development of
- about, 29–30, 43
- adding virtual devices, 46–50
- devices, 52–59
- installing Android Studio, 43–44
- installing Android Studio’s Flutter plugin, 44–46
- installing Flutter, 50–52
- launching Android Studio, 44
- running sample programs from book, 63–66
- setting up computer for, 332
- steps for, 32–42
- tools for, 30–32
- using Android Studio, 59–63
- ART (Android runtime), 12
- asking questions, 329
- assets, declaring, 325–326
- assignment statement, 115
-
async
keyword (Dart), 264–266, 295 - at-sign (@), 151
-
automaticallyImplyLeading
parameter, 266 - AVD (Android Virtual Devices)
- AVD Manager, opening, 48–50
- avoiding mistakes, 323–326
-
await
keyword (Dart), 264–266, 295
B
- ’bite-size’ programs, 209
-
bitLength
property, 227 - Black Screen app, 23–24
- blank spaces, 38, 94
- block comments, 120–121
- blue circle
-
bool
type, 122 -
border
parameter, 178 -
borderRadius
parameter, 178 - bouncing around, animation and, 308–310
- bounded constraint, 194–195
- box widget, 23
-
break
statement, 282–283 - breaking connections, 55–56
-
build
method, 129–130, 135–136, 137, 139, 151–152, 202 -
buildColumn
method, 170
C
- The C Programming Language (Kernighan and Ritchie), 69
- changing orientation for devices, 175
- charging cables, 55
- Cheat Sheet (website), 6
- checking connections, 55–56
-
children
parameter, 303 - classes
- about, 79–83
- abstract, 138
Account
, 228Animation
, 300Color
, 171Curves
, 310DateTime
, 123DetailPage
, 280DropdownMenuItem
, 242Flex
, 199Flexible
, 199GestureDetector
, 316, 317- Hello World program, 79–83
Icons
, 151Image
, 103int
, 113, 121, 227, 228_MyHomePage
, 202_MyHomePageState
, 162, 224, 260, 307Navigator
, 275StatefulWidget
, 307StatelessWidget
, 80, 151–152Widget
, 124
- closed project, 59
- code
- code decoration, 121
- code listing
- accessing online data, 290–292
- adding widgets, 91–92
- aligning text, 99
- animation along straight lines, 304
- basic navigation, 252–253
- captioned boxes, 183–184
- centering text, 84, 96
- changing animation size/color, 310–311
- changing animation velocity, 308–309
- checking device orientation, 199–200
- columns, 181–182
- copying iPhone apps, 90
- creating functions, 106
- creating list items one-by-one, 285–286
- creating lists, 277–278
- creating named routes, 273–275
- curves, 312–313
- debugging, 193
- displaying images, 103
- dragging widgets, 315
- dropdown buttons, 240–242
- enhancing apps, 146–147
- expanding widgets, 187–188, 189–190, 192
- function declarations, 124–125
- Hello World program, 70, 105
- JSON code, 293–294
- for layout, 164–166
- margin, 178–179, 179–180
- master-detail interface, 251–252
- nesting widgets, 185
- padding, 178–179, 179–180
- passing data back to sources, 261–262
- passing data from sources to destinations, 256–257
- passing data in both directions, 268–269
- preparing for animation, 298–299
- pressing floating action buttons, 132–133
- radio buttons, 231–232
- responding to a button press, 215–216
- rows, 181–182
- slider app, 217–218
- specifying relative size, 197–198
- for statement, 289
Switch
app, 208–209- using functions, 106
- using scaffolds, 86, 88
- widgets, 26
- collection for, 289–290
- color
-
Color
class, 171 -
color
property, 177, 312 -
Column
widget, 91, 173–175, 182, 281 - columns
- command line interfaces, 50
- comments, 120–121
- compatibility, 16, 213–214
- compiler, 23–24
- compiling, 21
- composition hierarchy, 81
- compressed archive files, 35
- computers
- Macs
- conditional expression, 213
- conditional operator, 213
- configuring Android Studio, 35–36
- connections, breaking/checking, 55–56
-
const
keyword (Dart), 211–213 -
ConstraintsLogger
widget, 196 - constructor call, 73
- constructors, parameters for, 75–76
-
Container
widget, 176–181 -
context
parameter, 203 - control. see control element
- control element
- controlling Back button, 266–267
- Cordova (Apache), 19
_counter
variable, 156–157
D
- Dalvik bytecode instructions, 24
- Dart programming language
- about, 11
- application programming interface (API), 14–15, 123
async
keyword, 264–266, 295await
keyword, 264–266, 295- built-in types, 121–123
- case sensitivity in, 70, 323
const
keyword, 211–213- Dartfmt tool, 111
- declarations, 112–113
enum
feature, 89- expressions, 114–117
Extension
keyword, 248–250highlight
function, 117–119- import declarations, 123–124
int.parse
method, 230- library (website), 124
- literals, 114–117
- programming in, 112–124
for
statement, 288–290- statements, 112–113
- strings, 93–94
switch
statement, 282–283- top-level variables, 259
- types, non-built-in, 123
- typing feature, 113–114
var
keyword, 119–121- variables, 114–117
dartdoc
program, 120–121- Dartfmt tool, 111
- data
- data cables, 55
DateTime
class, 123- dating app, 337–345
- declarations
- declaring
decoration
parameter, 177–178- density-independent pixel (dp), 172
- dependencies, declaring, 325–326
- desktop, 13
- destination page, 255
- destinations, passing data from sources to, 256–261
DetailPage
class, 280- developers, 10
- development computer, 31
- devices
- changing orientation, 175
- iPhones
- physical
- directories, 33
- displaying
displayNicely
function, 249–250dispose
method, 223dispose
method (Flutter), 230distanceFromLeft
, 318distanceFromRight
, 318distanceFromTop
, 318divisions
parameter, 219DO
statement, 288- doc comments, 120–121
- documentation, 82–83
- dollar sign ($), 126
- dot notation, 227–229
double
, 113–114- double quotation marks, 93
double
type, 121- downloading software, 31
- dp (density-independent pixel), 172
- dragging widgets, 314–319
- dropdown buttons, creating, 239–245
DropdownMenuItem
class, 242
E
EdgeInsets
object, 172- Editor area (Android Studio), 62
- emulators
- encapsulation, 162
- end-of-line comments, 120–121
endsWith
method, 228- enhancing apps, 146–162
enum
feature (Dart), 89- enums, creating, 233
- escape sequence, 212
- event driven programming, 142
- event handler, 140
- events
Expanded
widget, 186–199, 281, 325- expressions
Extension
keyword (Dart), 248–250
F
- fat arrow (=>) notation, 127
- feedback, 214–217
- fetching data from Internet, 290–296
- field, 156
- filename extensions, 34
- files
- finite state machine diagram, 270, 272
FlatButton
widget, 244Flex
class, 199- flex factor, 198
flex
property, 175, 199Flexible
class, 199- floating action buttons
- Flutter. see also specific topics
- Flutter Doctor, 50
- Flutter Inspector, 94
- Flutter SDK path, 33
- folders, 33
for
statement (Dart), 288–290- FORTRAN, 114, 288
- fragmentation, 17
- framework (Flutter)
- function call, 108
- function declarations
- functions
- anonymous, 153–156
_changeText
, 140–141, 144–145, 154- creating, 106–112
displayNicely
, 249–250get
, 295_getNewInfo
, 144_getNewText
, 141, 145getSuffix
, 283_handlerFunction
, 143highlight
, 109, 112–113, 116, 117–119, 126–127, 130_incrementCounter
, 158–159, 323–324main
, 127, 128, 139, 228print
, 113setState
, 143–145, 153, 154, 155, 306, 317, 324sqrt
, 314_updateAgeSwitch
, 210–211, 216_updateGenderRadio
, 234_updateResults
, 216- using, 106–112
VoidCallback
, 155, 210–211
G
_genderRadioValue
, 236
H
_handlerFunction
function, 143
- hardware, 10–15
- Hardware Accelerated Execution Manager (HAXM), 53
- header, 108
height
parameter, 169, 176- Hello World program
highlight
function, 109, 112–113, 116, 117–119, 126–127, 130hint
parameter, 243- history, of Flutter, 18–20
- home directory, 33
home
parameter, 275- Homebrew, 57
- hot reload, 25, 85
- hot restart, 24, 85
- hybrid app development, 18
I
- ICANN (Internet Corporation for Assigned Names and Numbers), 40
Icon
instance, 151- icons
Icons
class, 151- IDE (integrated development environment), 30
if
statement, 200–201, 213–214, 244- if-null operator, 239
Image
class, 103- images, displaying, 100–104
- import declarations, in Dart programming language, 123–124
import
statements, 160–161- imports, adding, 325
- indentation, 77–78, 326
- index, 92, 245, 324
- infinity symbol (∞), 315
- inheritance hierarchy, 81
initialRoute
parameter, 276initState
method, 223, 224–225, 230- installing
- instance, 79
- instance variable, 156
int
class, 113, 121, 227, 228- integrated development environment (IDE), 30
- Intel Hardware Accelerated Execution Manager (HAXM), 53
- Intel Virtualization Technology (VT), 53
- Internet, fetching data from, 290–296
- Internet Corporation for Assigned Names and Numbers (ICANN), 40
- Internet resources
- Android Studio IDE, 31
- Cheat Sheet, 6
Color
class documentation, 171curve
values, 309- Dart library, 124
- example Flutter apps, 30
- Flutter API reference documentation, 15
- Flutter library, 124
- Flutter SDK, 31
- Homebrew, 57
- images in
Icons
class, 151 - Material Design, 73
- Material Design’s elevation property, 89
- The Movie Database, 293
@override
annotations, 152- swatches, 149
- for this book, 31, 63
- Virtual Studio Code (VS Code), 33
- interpolating strings, 125–126
int.parse
method (Dart), 230int.tryParse
method, 230- iPhones
isEmpty
property, 227isEven
property, 227
J
K
L
label
parameter, 169, 220- landscape mode, 175
- Last-In-First-Out (LIFO) rule, 255
- launching
- layout
- about, 163–164
- adding padding, 171–173
- color, 170–171
Column
widget, 173–175Container
widget, 176–181- creating parameter lists, 169–170
- creating pieces of code, 167–169
- device size, 199–203
- examples of, 164–166
Expanded
widget, 186–199- nesting levels, 183–186
- nesting rows/columns, 181–183
SizedBox
widget, 175
leading
parameter, 266- learning, importance of, 329
left
property, 302length
property, 227- library. see application programming interface (API)
- LIFO (Last-In-First-Out) rule, 255
List
type, 122, 287- listing, code
- accessing online data, 290–292
- adding widgets, 91–92
- aligning text, 99
- animation along straight lines, 304
- basic navigation, 252–253
- captioned boxes, 183–184
- centering text, 84, 96
- changing animation size/color, 310–311
- changing animation velocity, 308–309
- checking device orientation, 199–200
- columns, 181–182
- copying iPhone apps, 90
- creating functions, 106
- creating list items one-by-one, 285–286
- creating lists, 277–278
- creating named routes, 273–275
- curves, 312–313
- debugging, 193
- displaying images, 103
- dragging widgets, 315
- dropdown buttons, 240–242
- enhancing apps, 146–147
- expanding widgets, 187–188, 189–190, 192
- function declarations, 124–125
- Hello World program, 70, 105
- JSON code, 293–294
- for layout, 164–166
- margin, 178–179, 179–180
- master-detail interface, 251–252
- nesting widgets, 185
- padding, 178–179, 179–180
- passing data back to sources, 261–262
- passing data from sources to destinations, 256–257
- passing data in both directions, 268–269
- preparing for animation, 298–299
- pressing floating action buttons, 132–133
- radio buttons, 231–232
- responding to a button press, 215–216
- rows, 181–182
- slider app, 217–218
- specifying relative size, 197–198
- for statement, 289
Switch
app, 208–209- using functions, 106
- using scaffolds, 86, 88
- widgets, 26
- lists
ListTile
widget, 287ListView
widget, 100, 279–284, 285–287, 289, 325- literals, in Dart programming language, 114–117
- loose constraint, 196
M
- macOS, filename extensions in, 34
- Macs
- main axis, 98
main
function, 127, 128, 139, 228- main window (Android Studio), 60–63
mainAxisAlignment
property, 173, 177, 182–183Map
type, 122, 245- maps, creating, 245
- margin, 181
margin
parameter, 178–181- master-detail interface, 251–252
- Material Design
Material
widget, 78, 81, 85, 87, 89, 179MaterialApp
widget, 78max
parameter, 219- members, 228
- methods
abs
, 228- abstract, 138
build
, 129–130, 135–136, 137, 139, 151–152, 202buildColumn
, 170_buildDropdownButtonRow
, 244_buildExpandedBox
, 198buildPositionedWidget
, 304, 318buildRoundedBox
, 191_buildRowOfThree
, 186, 191createState
, 136, 139dispose
, 223, 230endsWith
, 228getAnimation
, 305–306, 307, 316goToDetailPage
, 254, 280initState
, 223, 224–225, 230int.parse
, 230int.tryParse
, 230onHorizontalDragUpdate
, 316onPanUpdate
, 316onScaleUpdate
, 316onSecondaryTapDown
, 316parse
, 227pushedNamed
, 275replaceAll()
, 235shorten
, 238–239split
, 228toRadixString
, 228toString
, 235, 236toUpperCase
, 228trim
, 228updateOverview
, 296- for widgets, 135–138
min
parameter, 219- mistakes, avoiding, 323–326
- mixin, 301
- mobile app development
- about, 29–30, 43
- adding virtual devices, 46–50
- devices, 52–59
- installing Android Studio, 43–44
- installing Android Studio’s Flutter plugin, 44–46
- installing Flutter, 50–52
- launching Android Studio, 44
- running sample programs from book, 63–66
- setting up computer for, 332
- steps for, 32–42
- tools for, 30–32
- using Android Studio, 59–63
- The Movie Database, 293
N
- named constructor, 103
- named parameter, 76
- names
- naming parameters, 128–129
- native code, 17
- navigation
- about, 247–248
- basic, 252–253
- creating named routes, 272–276
- destination page, 255
Extension
keyword, 248–250- fetching data from Internet, 290–296
- master-detail interface, 251–252
- passing data back to sources, 261–267
- passing data from sources to destinations, 256–261
- passing data in both directions, 267–272
- scrolling, 284
- source page, 255
- navigation bar (Android Studio), 61
Navigator
class, 275- nesting
- null-aware operator, 238
num
type, 121
O
- Objective-C language, 25
- object-oriented programming, 227
- objects
- obtaining software, 32–34
- On The Web icon, 6
onChanged
event handler, 216, 220, 222, 243onHorizontalDragUpdate
method, 316onPanUpdate
method, 316onPressed
event handler, 216onScaleUpdate
method, 316onSecondaryTapDown
method, 316onWillPop
parameter, 267- open project, 59
- opening
- operating system (OS) software, 11
- orientation, changing for devices, 175
orientation
property, 202- OS (operating system) software, 11
- OS user interface, 13
- overflow, 187
override
annotation, 151–152
P
- package, 40
- Packages view (Android Studio), 62
- padding
padding
parameter, 178–181Padding
widget, 26, 171–173- parameterized list
- parameters
- about, 108–112
- adding, 148–151
alignment
, 177automaticallyImplyLeading
, 266border
, 178borderRadius
, 178children
, 303- for constructors, 75–76
context
, 203decoration
, 177–178divisions
, 219height
, 169, 176hint
, 243home
, 275initialRoute
, 276itemBuilder
, 279–280itemCount
, 279, 325label
, 169, 220leading
, 266margin
, 178–181max
, 219min
, 219- named, 76
- naming, 128–129
onWillPop
, 267padding
, 178–181- positional, 76
theme
, 148title
, 148value
, 220, 243vertical
, 172width
, 176
- parentheses, 323–324
parse
method, 227- passes constraints, 194
- passing
- physical devices
- Pixel C tablet, 202
- platform, 16
- plug-ins, 19
- plus sign (+), 94
- polling, 142
- popping, off stacks, 255–256
- portrait mode, 175
- positional parameter, 76
Positioned
widget, 302, 304, 314, 317- practice, importance of, 327
- preparing, for animation, 297–303
- pressing floating action buttons, 132–146
print
function, 113- programmer, 10
- programming languages
- Dart
- about, 11, 112–124
- application programming interface (API), 14–15, 123
async
keyword, 264–266, 295await
keyword, 264–266, 295- built-in types, 121–123
- case sensitivity in, 70, 323
const
keyword, 211–213- Dartfmt tool, 111
- declarations, 112–113
enum
feature, 89- expressions, 114–117
Extension
keyword, 248–250highlight
function, 117–119- import declarations, 123–124
int.parse
method, 230- library (website), 124
- literals, 114–117
- programming in, 112–124
for
statement, 288–290- statements, 112–113
- strings, 93–94
switch
statement, 282–283- top-level variables, 259
- types, non-built-in, 123
- typing feature, 113–114
var
keyword, 119–121- variables, 114–117
- defined, 11
- Dart
- programs
- Project tool button (Android Studio), 62
- Project tool window (Android Studio), 61–62
- Project view (Android Studio), 61
- properties
- public API, 293–294
pubspec.yaml
file, 325–326- punctuation characters, 38, 76–77
pushedNamed
method, 275- pushing, to stacks, 255–256
Q
R
- radio buttons, creating, 230–239
- radio groups, building, 233–235
RaisedButton
widget, 215, 244, 254, 255- React Native, 20
- real devices. see physical devices
- Remember icon, 5
replaceAll()
method, 235- researching technology, 328
- Reset button, 244
- resources, Internet
- Android Studio IDE, 31
- Cheat Sheet, 6
Color
class documentation, 171curve
values, 309- Dart library, 124
- example Flutter apps, 30
- Flutter API reference documentation, 15
- Flutter library, 124
- Flutter SDK, 31
- Homebrew, 57
- images in
Icons
class, 151 - Material Design, 73
- Material Design’s elevation property, 89
- The Movie Database, 293
@override
annotations, 152- swatches, 149
- for this book, 31, 63
- Virtual Studio Code (VS Code), 33
return
statement, 110, 112, 283- return value, 108–112
right
property, 302- Ritchie, Dennis (author), 288
- The C Programming Language, 69
- routes
- rows, nesting, 181–183
- Run icon, 85
- Run tool window (Android Studio), 62
Runes
type, 122- running
- runtime, 12
S
SafeArea
widget, 181Scaffold
widget, 87- scaffolds, creating, 86–87
- scrolling, 284
- SDK (Software Development Kit), 30
- SEARCH ON WIDGETS IN FIRST 100 PAGES
- sending URLs to servers, 295
- servers, sending URLs to, 295
Set
type, 122setState
function, 143–145, 153, 154, 155, 306, 317, 324- setup, computer for mobile app development, 332
shorten
method, 238–239- showing
- simulator, 31
- single quotation marks, 93
SingleChildScrollView
, 284- size
size
property, 311SizedBox
widget, 175- slash character (/), 275
- slashes (//), 77, 120
- sleep, importance of, 330
- slider app, 217–220
- software
- Software Development Kit (SDK), 30
- source code, 10
- source page, 255
- sources
split
method, 228sqrt
function, 314- square brackets, 296
Stack
, 302, 303- stacks, 255–256
- Stanley’s Swell Shaving Cream/Superior Shaving Cream, 131–132
- starting
- state, 134
State
object, 223- stateful widgets, 134–135
StatefulWidget
class, 307- stateless widgets, 134–135
StatelessWidget
class, 80, 151–152- statements
- static members, 229
- static variables, 260
- status bar (Android Studio), 63
- straight lines, animation along, 303–307
-
String
instance, 114, 122, 228 - strings
- styling, in Hello World program, 83–104
- swatch, 149
- Swift language, 25
Switch control
, 208–214switch
statement (Dart), 282–283Symbol
type, 122- system image, 47
T
- target devices, 31
- Technical Stuff icon, 6
- technology, researching, 328
- ternary operator, 214
- testing apps on physical devices, 53–59
- text, centering, 94–100
- text fields, 220–230
text
property, 227Text
widget, 26, 75, 81, 83, 84–87, 91, 223, 280TextEditingController
instance, 227theme
parameter, 148- ticker, 301
- tight constraint, 196
- Tip icon, 5
title
parameter, 148- toolbar (Android Studio), 61
- tools
tooltip
string, 151- top-level declaration, 159
- top-level names, 162
- top-level variables (Dart), 259
toRadixString
method, 228toString
method, 235, 236- Touge, Alice (historian), 20
toUpperCase
method, 228- trailing comma, 76–77, 111
trim
method, 228- triple quotation marks, 94
- type safe, 114
- typing
U
updateOverview
method, 296
_updateResults
function, 216
V
- value indicator, 220
value
parameter, 220, 243- values, of properties, 97
var
keyword, 119–121- variable declarations, 115
- variable names, declaring, 224
- variables
vertical
parameter, 172- virtual devices
- Virtual Studio Code (VS Code), 33
- Virtualization Technology (VT), 53
Visibility
widget, 259- visual tweaks, adding, 88–89
VoidCallback
function, 155, 210–211- VT (Virtualization Technology), 53
W
- Warning icon, 5
- websites
- Android Studio IDE, 31
- Cheat Sheet, 6
Color
class documentation, 171curve
values, 309- Dart library, 124
- example Flutter apps, 30
- Flutter API reference documentation, 15
- Flutter library, 124
- Flutter SDK, 31
- Homebrew, 57
- images in
Icons
class, 151 - Material Design, 73
- Material Design’s elevation property, 89
- The Movie Database, 293
@override
annotations, 152- swatches, 149
- for this book, 31, 63
- Virtual Studio Code (VS Code), 33
Widget
classes, 124
<Widget>
, 152–153
- widgets
- about, 26, 79–83
- adding, 91–93
Application
, 26Background
, 26- box, 23
Button
, 26Center
, 83–85, 302Column
, 91, 173–175, 182, 281ConstraintsLogger
, 196Container
, 176–181- Cupertino, 90, 256
- displaying, 194–195
- dragging, 314–319
Expanded
, 186–199, 281, 325FlatButton
, 244- Hello World program, 79–83
- layout of, 163–164
ListTile
, 287ListView
, 100, 279–284, 285–287, 289, 325Material
, 78, 81, 85, 87, 89, 179- Material Design, 256
MaterialApp
, 78- methods for, 135–138
Padding
, 26, 171–173Positioned
, 302, 304, 314, 317RaisedButton
, 215, 244, 254, 255SafeArea
, 181Scaffold
, 87SizedBox
, 175- stateful, 134–135
- stateless, 134–135
Text
, 26, 75, 81, 83, 84–87, 91, 223, 280Visibility
, 259
width
parameter, 176- Windows
- “within-ness,” 81–82
- working directory, 51
X
- Xamarin, 20
Y
.yaml
file, 295
Z
- zip files, 35