Reader small image

You're reading from  Flutter Cookbook, Second Edition - Second Edition

Product typeBook
Published inMay 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781803245430
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
Simone Alessandria
Simone Alessandria
author image
Simone Alessandria

Simone Alessandria wrote his first program when he was 12. It was a text-based fantasy game for the Commodore 64. Now, he is a trainer (MCT), author, speaker, passionate software architect, and always a proud coder. He is the founder and owner of Softwarehouseit. His mission is to help developers achieve more through training and mentoring. He has authored several books on Flutter, including Flutter Projects, published by Packt, and web courses on Pluralsight and Udemy.
Read more about Simone Alessandria

Right arrow

Preface

These recipes cover the most important Flutter features that will allow you to develop real-world apps. In each recipe, you will learn about and immediately use some of the tools that make Flutter so successful: widgets, state management, asynchronous programming, connecting to web services, persisting data, creating animations, using Firebase and machine learning, and developing responsive apps that work on different platforms, including desktop and the web.

Flutter is a developer-friendly, open source toolkit created by Google that you can use to create applications for Android and iOS mobile devices, the web, and desktop.

There are 16 chapters in this book, which you can read independently from one another: each chapter contains recipes that highlight and leverage a single Flutter feature. You can choose to follow the flow of the book or skip to any chapter if you feel confident with the concepts.

Flutter uses Dart as a programming language. Chapter 3, Dart: A Language You Already Know, is an introduction to Dart, its syntax, and its patterns, and it gives you the necessary knowledge to be productive when using Dart in Flutter.

In later chapters, you’ll see recipes that go beyond basic examples; you will be able to play with code and get hands-on experience in using basic, intermediate, and advanced Flutter tools.

Who this book is for

This book is for developers who are familiar with an object-oriented programming language. If you understand concepts such as variables, functions, classes, and objects, this book is for you.

Prior knowledge of Dart is not required as it is introduced in Chapter 3, Dart: A Language You Already Know.

If you already know and use languages such as Java, C#, Swift, Kotlin, and JavaScript, you will find Dart surprisingly easy to learn.

What this book covers

Chapter 1, Getting Started with Flutter, helps you set up your development environment.

Chapter 2, Creating Your First Flutter App, shows how to create your first app, and check that your development environment works as expected.

Chapter 3, Dart: A Language You Already Know, introduces Dart, its syntax, and its patterns.

Chapter 4, Introduction to Widgets, shows how to build simple user interfaces with Flutter.

Chapter 5, Mastering Layout and Taming the Widget Tree, shows how to build more complex screens made of several widgets.

Chapter 6, Adding Interactivity and Navigation to Your app, contains several recipes that add interactivity to your apps, including interacting with buttons, reading a text from a TextField, changing the screen, and showing alerts.

Chapter 7, Basic State Management, introduces the concept of State in Flutter: instead of having screens that just show widgets, you will learn how to build screens that can keep and manage data.

Chapter 8, The Future is Now: Introduction to Asynchronous Programming, contains several examples of one of the most useful and interesting features in programming languages: the concept of the asynchronous execution of tasks.

Chapter 9, Data Persistence and Communicating with the Internet, gives you the tools to connect to web services and persist data on your device.

Chapter 10, Advanced State Management with Streams, shows how to deal with Streams, which are arguably the best tool for creating reactive apps.

Chapter 11, Using Flutter Packages, explains how to choose, use, build, and publish Flutter packages.

Chapter 12, Adding Animations to Your app, gives you the tools you need to build engaging animations in your apps.

Chapter 13, Using Firebase, shows how to leverage a powerful backend without any code.

Chapter 14, Firebase Machine Learning, shows how to add machine learning features to your apps by using Firebase.

Chapter 15, Flutter Web and Desktop, shows you how to use the same code base to build apps for the web and desktop.

Chapter 16, Distributing Your Mobile app, outlines the steps required to publish an app to the main mobile stores: the Google Play Store and the Apple App Store.

To get the most out of this book

Some experience in at least one object-oriented programming language is strongly recommended.

In order to follow along with the code, you will need a Windows PC, Mac, Linux, or Chrome OS machine connected to the web, with at least 8 GB of RAM and the permissions to install new software.

An Android or iOS device is suggested but not necessary as there are simulators/emulators that can run on your machine. All software used in this book is open source or free to use.

Chapter 1, Getting Started with Flutter, explains in detail the installation process; however, you should have the following:

Software/hardware

OS Requirements

Recommended editors: Visual Studio Code, Android Studio, or IntelliJ Idea

Windows, macOS, or Linux

The Flutter SDK

Windows, macOS, or Linux

An emulator/simulator or an iOS or Android device

Windows, macOS, or Linux

In order to create apps for iOS, you will need a Mac.

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

If you like this book or want to share your ideas about it, please write a review on your favorite platform. This will help us make this book better, and you’ll also earn the author’s and reviewers’ everlasting gratitude.

Download the example code files

The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Flutter-Cookbook-Second-Edition/. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/WE615.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: “Add the latest version of the lint package as a dev dependency in your pubspec.yaml, and remove any other linting packages you may find there.”

A block of code is set as follows:

dependencies: 
  flutter: 
    sdk: flutter 
  http: ^0.13.5

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

dev_dependencies: 
  flutter_test: 
    sdk: flutter 
  lint: ^2.0.0

Any command-line input or output is written as follows:

# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample
     /etc/asterisk/cdr_mysql.conf

Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: “ In order to use Google Maps, you need to obtain an API key.”

Warnings or important notes appear like this.

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email feedback@packtpub.com and mention the book’s title in the subject of your message. If you have questions about any aspect of this book, please email us at questions@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you reported this to us. Please visit http://www.packtpub.com/submit-errata, click Submit Errata, and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packtpub.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit http://authors.packtpub.com.

Share your thoughts

Once you’ve read Flutter Cookbook, Second Edition, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application. 

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

    https://packt.link/free-ebook/9781803245430

  2. Submit your proof of purchase
  3. That’s it! We’ll send your free PDF and other benefits to your email directly
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Flutter Cookbook, Second Edition - Second Edition
Published in: May 2023Publisher: PacktISBN-13: 9781803245430
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Simone Alessandria

Simone Alessandria wrote his first program when he was 12. It was a text-based fantasy game for the Commodore 64. Now, he is a trainer (MCT), author, speaker, passionate software architect, and always a proud coder. He is the founder and owner of Softwarehouseit. His mission is to help developers achieve more through training and mentoring. He has authored several books on Flutter, including Flutter Projects, published by Packt, and web courses on Pluralsight and Udemy.
Read more about Simone Alessandria