Chapter 1. Meet Flutter
Listing 1.1. Example build method for the custom QuantityCounter stateful widget
Chapter 2. A brief intro to Dart
Chapter 3. Breaking into Flutter
Listing 3.1. An example button widget
Listing 3.2. A widget with configuration
Listing 3.3. Adding a raised button to _MyHomePageState.build
Listing 3.4. Column widget in the counter app
Listing 3.5. Wrapping widgets in a Row
Listing 3.6. Adding a second button to the Row
Listing 3.7. Adding an image to your Flutter pubspec.yaml file
Listing 3.8. Adding an image to your Flutter app
Listing 3.9. Adding a Container widget
Listing 3.10. _MyHomePageState configuration
Chapter 4. Flutter UI: Important widgets, themes, and layout
Listing 4.1. Weather app file structure
Listing 4.2. pubspec.yaml configuration for the weather app
Listing 4.3. The weather app main function
Listing 4.4. setPreferredOrientations in the weather app
Listing 4.5. The top-level widget in main.dart
Listing 4.6. The build method of the MyApp widget
Listing 4.7. Scaffold full property list
Listing 4.8. Using PreferredSize in a scaffold
Listing 4.9. ThemeData in the weather app
Listing 4.10. Screen-aware sizing methods
Listing 4.11. Stack code in the forecast page
Listing 4.12. Example of non-animated Stack code
Listing 4.13. The API for the Table widget
Listing 4.14. Using FixedColumnWidth on rows 0, 2, and 3 makes row 1 flexed
Listing 4.15. Table code from the weather app
Listing 4.16. Table cell examples from the weather app
Listing 4.17. A portion of the ForecastPageState.build method
Listing 4.18. TabController and TabBar widget setup
Listing 4.19. Implementing Flutter tabs in the weather app
Chapter 5. User interaction: Forms and gestures
Listing 5.1. Using the drag gesture
Listing 5.2. Handling the end of a drag gesture
Listing 5.3. Using Dismissible in a collection
Listing 5.4. add_city_page.dart outline
Listing 5.5. Initial form setup in the weather app
Listing 5.6. TextFormField example
Listing 5.7. TextFormField example
Listing 5.8. DropdownButtonFormField example
Listing 5.9. Creating CountryDropdownField in the AddNewCity widget
Listing 5.10. Implementing the check box form field
Listing 5.11. InputDecoration example
Listing 5.13. Conditional auto-validation
Listing 5.14. Saving the form state from a button
Chapter 6. Pushing pixels: Flutter animations and using the canvas
Listing 6.1. Animation controller example
Listing 6.2. The complete animated Sun widget
Listing 6.3. Passing an animation into an animated widget
Listing 6.4. Setting up the State object for animation use
Listing 6.5. _ForecastPageState._render method
Listing 6.6. Creating the TimePickerRow widget
Listing 6.7. The _ForecastPageState._handleStateChange method
Listing 6.8. _ForecastPageState animation helper methods
Listing 6.10. The bare minimum for a custom painter
Listing 6.11. Half of the CloudPainter.paint method
Listing 6.12. The CloudPainter.paint method
Listing 6.13. ForecastPageState.handleStateChange method
Listing 6.14. ForecastPageState._buildTweens method
Listing 6.15. Passing animation values into widgets
Chapter 7. Flutter routing in depth
Listing 7.1. Important files for the e-commerce Farmers Market app
Listing 7.2. AngularDart Router route definitions
Listing 7.3. Define routes in the MaterialApp widget
Listing 7.4. AppMenu widget’s build method, condensed to widgets only
Listing 7.5. Flutter’s AboutListTile Material widget
Listing 7.6. Menu drawer item in a ListTile widget
Listing 7.7. Navigating from the AppMenu widget
Listing 7.8. UserAccountsDrawerHeader usage in AppMenu widget
Listing 7.9. Pass route observers into the MaterialApp widget
Listing 7.10. Listen to the route observer
Listing 7.11. Example code showing routing on the fly
Listing 7.12. Navigate to a new route on the fly
Listing 7.13. Choice code from the AddToCartBottomSheet widget
Chapter 8. Flutter state management
Listing 8.1. StatefulWidget example
Listing 8.3. Handle a state object with the inherited widget
Listing 8.4. AppState.build method
Listing 8.5. Functionality to control quantity with InheritedWidget
Listing 8.6. Override the didChangeDependencies method
Listing 8.7. Call method from the inherited widget from the bottom sheet
Listing 8.8. Blocs work with stream builders (their outputs are all streams)
Listing 8.9. The BlocProvider class (for cleaner code)
Listing 8.10. AppStateContainer stateful widget
Chapter 9. Async Dart and Flutter and infinite scrolling
Listing 9.1. Example Dart code using streams and sinks
Listing 9.3. async and await example
Listing 9.4. Get data asynchronously
Listing 9.5. The catchError method
Listing 9.6. try/catch with async calls
Listing 9.7. Stream using the hamburger restaurant example
Listing 9.8. Broadcast stream controller example
Listing 9.9. GoodBurgerRestaurant class
Listing 9.10. Custom stream transformer class
Listing 9.11. Custom stream transformer class, continued
Listing 9.12. Multiple streams for each category
Listing 9.13. A longer way to create a list of controllers
Listing 9.14. Stream as input to work with state outside the widget
Listing 9.15. StreamBuilder displays data that constantly changes
Listing 9.16. StreamBuilder widget
Listing 9.17. Catalog bloc output for products, by category
Listing 9.18. A header sliver for the current category
Listing 9.19. Display the products for a category
Listing 9.20. SliverChildBuilderDelegate usage
Chapter 10. Working with data: HTTP, Firestore, and JSON
Listing 10.1. Adding the HTTP dependency to your Flutter app
Listing 10.2. An HTTP GET request
Listing 10.3. JSON object from getPosts call
Listing 10.4. Using todos in the UI
Listing 10.5. Example of a todo from the Typicode JSONPlaceholder service
Listing 10.7. fromJson factory methods
Listing 10.8. Parsing data out of an HTTP response
Listing 10.9. Creating a serializable model
Listing 10.10. Code generated by the json_serialization package
Listing 10.11. Todo controller
Listing 10.12. The root of the Flutter app
Listing 10.13. The Todo list page
Listing 10.14. The _TodoPageState build method
Listing 10.15. The finished pubspec file
Listing 10.16. Implement Firebase services
Listing 10.17. Convert a Firestore QuerySnapshot into a Dart object
Listing 10.18. Use abstract classes for dependency injection
Chapter 11. Testing Flutter apps
Listing 11.1. Todo app pubspec dependencies
Listing 11.2. Testable code from the todos completed counter
Listing 11.3. Basic unit test in Dart
Listing 11.4. Multiple expect calls in a test
Listing 11.5. Full unit test example
Listing 11.6. Mock services class
Listing 11.7. getTodos makes an HTTP request
Listing 11.8. Using mockito to stub an HTTP call
Listing 11.9. Basic widget test function
Listing 11.10. Basic widget test function
Listing 11.11. Finding and tapping on a button
Listing 11.12. Finding widgets by keys in tests
Listing 11.13. Todo app pubspec dependencies
Listing 11.14. Set up the flutter_driver extension
Appendix C. Flutter for web developers
18.225.149.238