Flutter for Beginners - Second Edition

Book description

Develop the real-world experience you need to build and launch your own Flutter apps with this full-color guide

Key Features

  • Get up to speed with the basics of Dart programming and delve into Flutter development
  • Learn about Flutter widgets, plugins, and animations to create a high-quality app user experience
  • Package and deploy your Flutter apps to achieve native-like performance

Book Description

There have been many attempts at creating frameworks that are truly cross-platform, but most struggle to create a native-like experience at high performance levels. Flutter achieves this with an elegant design and a wealth of third-party plugins, making it the future of mobile app development. If you are a mobile developer who wants to create rich and expressive native apps with the latest Google Flutter framework, this book is for you.

This book will guide you through developing your first app from scratch all the way to production release. Starting with the setup of your development environment, you'll learn about your app's UI design and responding to user input via Flutter widgets, manage app navigation and screen transitions, and create widget animations. You'll then explore the rich set of third party-plugins, including Firebase and Google Maps, and get to grips with testing and debugging. Finally, you'll get up to speed with releasing your app to mobile stores and the web.

By the end of this Flutter book, you'll have gained the confidence to create, edit, test, and release a full Flutter app on your own.

What you will learn

  • Explore the core concepts of the Flutter framework and how it is used for cross-platform development
  • Understand the fundamentals of the Dart programming language
  • Work with Flutter widgets and learn the concepts of stateful and stateless widgets
  • Add animation to your app using animated widgets and advanced animations techniques
  • Master the complete development lifecycle, including testing and debugging
  • Investigate the app release process to both mobile stores and the web

Who this book is for

This book is for developers looking to learn Google's revolutionary framework Flutter from scratch. No prior knowledge of Flutter or Dart is required.

Table of contents

  1. Flutter for Beginners Second Edition
  2. Foreword
  3. Contributors
  4. About the authors
  5. About the reviewer
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Share Your Thoughts
  7. Section 1: Introduction to Flutter and Dart
  8. Chapter 1: An Introduction to Flutter
    1. Technical requirements
    2. What is Flutter?
      1. Backed by Google
      2. Fuchsia OS and Flutter
      3. Dart
      4. One code base to rule them all
      5. Open source framework
    3. Hello Flutter – a first glimpse of Flutter
      1. Installing Flutter
      2. Development environment
      3. Hello world!
    4. Widgets, widgets, everywhere
      1. Flutter rendering
      2. Flutter – rendering by itself
      3. Composability
      4. Immutability
      5. Everything is a widget
    5. Building and running Flutter
      1. Debug mode
      2. Release mode
      3. Profile mode
      4. Supported platforms
      5. The pubspec.yaml file
      6. Running the generated project
    6. Summary
  9. Chapter 2: An Introduction to Dart
    1. Technical requirements
    2. Getting started with Dart
      1. The evolution of Dart
      2. How Dart works
      3. Introducing the structure of the Dart language
      4. Hands-on with Dart
    3. Variables and data types
      1. Variable declaration
      2. Null safety
      3. Built-in types
    4. Control flows and looping
      1. If/else
      2. While and do-while loops
      3. For loops
      4. break and continue
      5. Hands-on continued
    5. Functions and methods
      1. Function parameters
    6. Summary
  10. Chapter 3: Flutter versus Other Frameworks
    1. Native development
      1. Developers
      2. Project management
      3. Defect reports
      4. Performance
      5. Platform features
      6. Hot reload
      7. User experience
      8. App size
      9. New platforms
      10. Retired platforms
      11. Overview
    2. Cross-platform frameworks
      1. React Native
      2. Xamarin
      3. Cordova
      4. Popularity
    3. Flutter community
      1. Events
      2. News and discussion
      3. Resources
    4. Flutter strengths and weaknesses
      1. Strengths
      2. Weaknesses
    5. Summary
  11. Chapter 4: Dart Classes and Constructs
    1. Technical requirements
    2. Object orientation in Dart
      1. Objects and classes
      2. Other OOP artifacts
      3. Encapsulation
      4. Inheritance and composition
      5. Abstraction
      6. Polymorphism
      7. Functions as objects
    3. Understanding classes in Dart
      1. Class structure
      2. Constructors
      3. Class inheritance
      4. Abstract classes
      5. Interfaces
      6. Mixins
      7. Files and imports
    4. The enum type
    5. Using generics
      1. When and why to use generics
    6. Asynchronous programming
      1. Dart Futures
      2. Dart Isolates
    7. Summary
  12. Section 2: The Flutter User Interface – Everything Is a Widget
  13. Chapter 5: Widgets – Building Layouts in Flutter
    1. Technical requirements
    2. Stateful/stateless widgets
      1. Stateless widgets
      2. Stateful widgets
      3. Inherited widgets
      4. The widget key property
    3. Built-in widgets
      1. Basic widgets
      2. Material Design and iOS Cupertino widgets
      3. Layouts
    4. Streams
    5. Summary
  14. Chapter 6: Handling User Input and Gestures
    1. Technical requirements
    2. Handling user gestures
      1. Pointers
      2. Gestures
      3. GestureDetector
      4. Gestures in material widgets
    3. A deeper look at the stateful widget life cycle
      1. Key life cycle states
      2. Mounted
    4. Input widgets and forms
      1. Getting input through a controller
      2. FormField and TextField
      3. Accessing the FormField widget's state
      4. Form
    5. Custom input and FormField widgets
      1. Creating custom inputs
      2. Custom input widget example
    6. Summary
  15. Chapter 7: Routing – Navigating between Screens
    1. Technical requirements
    2. Understanding the Navigator widget
      1. Navigator 1.0 and 2.0
      2. Navigator
      3. Navigator 1.0
      4. Navigator 2.0
    3. Screen transitions
      1. PageRouteBuilder
      2. Custom transitions in practice
    4. Passing data between screens
      1. Passing state in widget parameters
      2. InheritedWidget
      3. BLoC
      4. Redux
      5. Other options
    5. Summary
  16. Section 3: Developing Fully Featured Apps
  17. Chapter 8: Plugins – What Are They and How Do I Use Them?
    1. Technical requirements
    2. What is a plugin?
      1. Benefits
      2. Drawbacks
    3. Where can I find plugins?
    4. How do I add a plugin to my project?
      1. The pubspec.yaml file
      2. flutter pub
      3. Using a plugin in your code
    5. How do plugins work on iOS and Android?
      1. MethodChannel
      2. CocoaPods
      3. Gradle
    6. Common issues
      1. Plugin breaking change
      2. Plugin not working
      3. PR not merged
      4. Inconsistent dependencies
      5. MissingPluginException
    7. Summary
  18. Chapter 9: Popular Third-Party Plugins
    1. Technical requirements
    2. Exploring Firebase plugins
      1. Firebase registration
      2. Connecting the Flutter app to Firebase
      3. FlutterFire plugins
      4. Firebase initialization
      5. Authentication
      6. Realtime Database
      7. Firestore
      8. Analytics and Crashlytics
      9. Cloud Storage
      10. AdMob
      11. Cloud Functions
      12. ML with Firebase ML Kit
      13. Messaging
    3. Understanding Google Maps and Places
    4. Exploring mobile device features
      1. Camera and QR codes
      2. Opening web pages
      3. Local storage
      4. Video
      5. Payment providers
      6. In-app purchases
      7. Opening files
    5. Plugins to help with your app support
      1. App version
      2. Device information
    6. Summary
  19. Chapter 10: Using Widget Manipulations and Animations
    1. Technical requirements
    2. Transforming widgets with the Transform class
      1. The Transform widget
      2. Understanding the Matrix4 class
      3. Exploring the types of transformations
    3. Introducing animations
      1. The Animation<T> class
      2. AnimationController
      3. CurvedAnimation
      4. Tween
    4. Using animations
      1. Rotate animation
      2. Scale animation
      3. Translate animation
    5. Using AnimatedBuilder
      1. The AnimatedBuilder class
      2. Revisiting our animation
    6. Implicitly animated widgets
      1. AnimatedContainer
      2. AnimatedFoo
    7. Summary
  20. Section 4: Testing and App Release
  21. Chapter 11: Testing and Debugging
    1. Technical requirements
    2. Unit testing
      1. The Dart test package
      2. Writing unit tests
      3. Unit test mocking
    3. Widget testing
      1. The flutter_test package
      2. Widget test example
      3. Running a widget test
    4. Debugging your app
      1. Observatory
      2. Additional debugging features
      3. Debugging in the IDE
    5. DevTools
      1. The widget inspector
      2. Profile mode
    6. Summary
  22. Chapter 12: Releasing Your App to the World
    1. Technical requirements
      1. Preparing the stores
      2. Preparing for web
    2. Releasing your app on Android
      1. AndroidManifest and build.gradle
      2. Build and upload your appbundle
    3. Releasing your app on iOS
      1. App Store Connect
      2. Xcode
      3. Build and upload
    4. Releasing your app on the web
      1. Firebase hosting
      2. PWA support
    5. Tracking app usage and crashes
      1. Crashlytics
      2. Google Analytics
    6. Summary
    7. Why subscribe?
  23. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share Your Thoughts

Product information

  • Title: Flutter for Beginners - Second Edition
  • Author(s): Thomas Bailey, Alessandro Biessek
  • Release date: October 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781800565999