Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Flutter Cookbook, Second Edition
Flutter Cookbook, Second Edition

Flutter Cookbook, Second Edition: 100+ step-by-step recipes for building cross-platform, professional-grade apps with Flutter 3.10.x and Dart 3.x , Second Edition

Arrow left icon
Profile Icon Simone Alessandria
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (39 Ratings)
Paperback May 2023 712 pages 2nd Edition
eBook
€8.99 €26.99
Paperback
€33.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Simone Alessandria
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (39 Ratings)
Paperback May 2023 712 pages 2nd Edition
eBook
€8.99 €26.99
Paperback
€33.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €26.99
Paperback
€33.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Flutter Cookbook, Second Edition

Flutter Cookbook, Second Edition: 100+ real-world recipes to build cross-platform applications with Flutter 3.3 powered by Dart 2.16

Welcome to Packt Early Access. We’re giving you an exclusive preview of this book before it goes on sale. It can take many months to write a book, but our authors have cutting-edge information to share with you today. Early Access gives you an insight into the latest developments by making chapter drafts available. The chapters may be a little rough around the edges right now, but our authors will update them over time.

You can dip in and out of this book or follow along from start to finish; Early Access is designed to be flexible. We hope you enjoy getting to know more about the process of writing a Packt book.

  1. Chapter 1: Getting Started with Flutter: Setting up your environment and choosing an IDE
  2. Chapter 2: Dart: A programming language you probably already know
  3. Chapter 3: Building Layouts, Hot Reload and Hot Restart...

Why Flutter?

Flutter is an open-source framework to build apps, created by Google. Before investing time and effort in learning a new framework, there is a critical question we need to answer: Is Flutter worth learning and using?

While the answer to this question probably depends on your needs and expectations, there are several reasons that make Flutter a great framework to learn and use. Some of them include:

  • Cross-platform: With Flutter, you can build apps for iOS and Android, web, desktop, and IoT devices with a single code base.
  • Fast development: Flutter includes several features that help speed up your development workflow. Among the most important, it’s worth mentioning hot reload, hot restart, and sound null safety support.
  • User interface: Flutter provides a rich set of widgets to create beautiful, high-performance apps.
  • Open source: Flutter and Dart (the programming language you use in Flutter) are open source and supported by Google...

Technical requirements

Flutter requires a 64-bit operating system. In particular:

Building mobile applications can be a taxing task for your computer. While the minimum hardware requirements to develop a Flutter app are relatively low, your developing experience will be greatly enhanced with the following specs:

  • 8 GB of random-access memory (RAM). 16 gigabytes (GB) is preferred, especially when using a virtual device (emulator or simulator).
  • At least 50 GB of available hard...

Installing Flutter: a high-level overview

You can start developing Flutter apps without any installation or configuration. You can quickly create prototypes and simple apps and share your code with fellow developers with an online tool called DartPad, available here: https://dartpad.dev. It is an online open-source tool that runs on any browser.

However, if you are serious about programming with Flutter, there will come a time when you need to develop your apps locally and, therefore, will need to configure your system.

Configuring your Flutter development environment is rather easy. You can divide the process into three parts:

  1. First, you must install the Flutter software development kit (SDK). Currently, you can build Flutter apps from Windows, macOS, Linux, and ChromeOS.
  2. Then, depending on your target platform, you have to install a specific platform SDK: Android, iOS, and/or desktop. You can also develop for the web, without installing any specific SDK...

Installing the Flutter SDK

Before you can build anything, you need to download the Flutter SDK.

On the main Flutter website at https://docs.flutter.dev/get-started/install, you’ll find the prebuilt packages for Windows, macOS, Linux, or ChromeOS—the currently supported platforms to create Flutter apps.

Figure 1.1: The Flutter installation page

Once you select your operating system, whatever your choice, you will find a section called Get the Flutter SDK. Here, you will find a compressed file (.zip for Windows and macOS, and .tar.gz for Linux and ChromeOS).

You should then create a directory for the Flutter SDK, and extract the contents of the compressed file into that directory; for instance, this could be c:\dev\flutter on a Windows machine or ~/development on other platforms.

There is another tool, called FVM (Flutter Version Management), that allows managing multiple versions of Flutter SDKs on your development machine.

If...

How to use Git to manage the Flutter SDK

An alternative way to install the Flutter SDK is using Git.

Since Flutter is open source and hosted on GitHub, if you clone the main Flutter repository, you’ll already have everything you need. As an added bonus, you can easily change to different versions of the Flutter SDK when needed.

The packages that are available to download on Flutter’s website are snapshots from the Git repository. Flutter uses Git internally to manage its versions, channels, and upgrades.

Installing Git

First, you need to make sure you have Git installed on your computer. Git is installed by default on most Mac and Linux machines. For Windows, you can download and install Git here: https://git-scm.com/download/win.

You can also download a Git client to make working with repositories a bit easier. Tools such as Sourcetree (https://www.sourcetreeapp.com) or GitHub Desktop (https://desktop.github.com) can simplify working with Git....

Setting up the command line and saving path variables

Now that you have installed the Flutter SDK, there are a few more steps needed to make the software accessible on your computer. Unlike apps with user interfaces (UIs), Flutter is primarily a command-line tool. Let’s quickly learn how to set up the command line on macOS, Windows, and Linux in the following sections.

macOS command-line setup

To use Flutter on macOS, you need to save the location of the Flutter executable to your system’s environment variables.

Newer Macs use the Z shell (also known as zsh). This is basically an improved version of the older Bash, with several additional features.

When using zsh, you can add a line to your zshrc file, which is a text file that contains the zsh configuration. If the file does not exist yet, you can create a new file as follows:

  1. Open the zshrc file with the following command in your Terminal:
    nano $HOME/.zshrc
    
  2. ...

Confirming your environment is correct with Flutter Doctor

Flutter comes with a tool called Flutter Doctor. This tool provides a list of everything that needs to be done to make sure that Flutter can run correctly. You are going to use Flutter Doctor as a guide during the installation process. This tool is also invaluable in checking whether your system is up to date.

In your Terminal window, type the following command:

flutter doctor

Flutter Doctor will tell you whether your platform SDKs are configured properly and whether Flutter can see any devices, including physical mobile devices, simulators and emulators, your desktop, and the web browser.

Configuring the iOS SDK

The iOS SDK is provided by a single application: Xcode. Xcode is one behemoth of an application; it controls all the official ways in which you will interact with Apple’s platforms and is only available for macOS. As large as Xcode is, there are a few pieces of software that are missing. Two of these are community tools: CocoaPods and Homebrew. These are package managers, or programs that install other programs. You can use both of these tools to build iOS apps.

Downloading Xcode

The iOS SDK comes bundled with Apple’s IDE, Xcode. The best place to get Xcode is through the Apple App Store:

  1. Press Command + Space to open Spotlight and then type in app store:
    Graphical user interface, text, application, email  Description automatically generated

    Figure 1.6: App Store results in Spotlight

    As an alternative, you can just click on the menu in the top-left corner of your screen and select App Store, but keyboard shortcuts are much more fun.

  1. After the App Store opens, search for Xcode and select...

Configuring the Android SDK setup

Just like with Xcode, Android Studio and the Android SDK come hand in hand, which should make this process fairly easy. But also like Xcode, Android Studio is just the starting point. There are a bunch of tiny tools that you’ll need to get everything up and running.

Installing Android Studio

Follow these steps to install Android Studio:

  1. You can download Android Studio at https://developer.android.com/studio.

    The website will autodetect your operating system and only show the appropriate download link:

    Graphical user interface, text, application, chat or text message  Description automatically generated

    Figure 1.10: Android Studio download page

    After Android Studio is installed, you’ll need to download your target Android SDK(s). From the Android Studio menu, select Preferences and then type android into the search field:

    Figure 1.11: Android Studio SDKs screen

    While it may be tempting to grab the most recent version of the Android SDK, you might want to choose the second most recent...

Which IDE/editor should you choose?

A developer’s IDE is a very personal choice, and developers may engage in heated battles over the best tool to use.

Ultimately, the choice is dependent on which tool you are most productive and more capable in. If you find yourself fighting with the tool rather than just writing code, then it might not be the right choice. As with most things, it’s more important to make choices based on what best fits your personal and unique style, rather than follow any prescribed doctrine.

You can develop Flutter apps with any editor, including Notepad and the Flutter CLI, but Flutter provides official plugins for four popular IDEs:

  • Android Studio
  • Visual Studio Code (VS Code)
  • IntelliJ IDEA
  • Emacs

Let’s compare and configure all four and find out which one might be right for you.

Android Studio

Android Studio is a mature and stable IDE. Since 2014, Android Studio has been promoted as...

Picking the right channel

One final item we need to cover before diving into building apps is the concept of channels. Flutter segments its development streams into channels, which is really just a fancy name for Git branches. Each channel represents a different level of stability for the Flutter framework. Flutter developers will release the latest features to the master channel first. As these features stabilize, they will get promoted to the beta channel, and then to the stable channel.

In previous Flutter versions, there was also a dev channel, between master and beta, but this was removed. The Flutter versioning policy will probably be updated in the near future, so please have a look at the Flutter build release page at https://github.com/flutter/flutter/wiki/Flutter-build-release-channels for the latest versioning updates.

Most of the time, you will probably want to stick to the stable channel. This will make sure that your code mostly runs without any...

Summary

By now, you should have a working Flutter environment set up. It is recommended that you rerun Flutter Doctor from time to time to check the status of your environment. The Doctor will also let you know when a new version of Flutter is available, which—depending on your channel—happens every few weeks or months. Flutter is still a relatively young framework and growing fast, so you should always keep your environment up to date.

The Flutter team is also very receptive to helping you with any technical issues you might encounter. If you run into an issue that hasn’t been documented yet, you can always reach out to the Flutter team directly on GitHub at https://github.com/flutter/flutter/issues.

Learning about the command line will become an invaluable skill. This can range from setting up and configuring your environment to writing build scripts, which we will do later in this book when we automate building and publishing the apps to the stores...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Thoroughly updated to cover the latest features in Flutter 3.10.x and Dart 3.x
  • Practical recipes to publish responsive, multi-platform apps from a single database
  • Covers not just the ‘hows’ but the ‘whys’ of Flutter’s features with examples

Description

Are you ready to tap into the immense potential of Flutter? With over 1,000 new mobile apps published every day on the Apple and Google Play stores, Flutter is transforming the landscape of app development. It's time for you to join the revolution. Introducing the second edition of Flutter Cookbook, a step-by-step guide designed exclusively for you. Whether you're a seasoned developer or just starting your coding journey, this book is your ultimate companion. Dive into the latest features of Flutter 3.10 and unlock the secrets to building professional-grade, cross-platform applications. With our recipe-based approach, we'll not only show you how to implement Flutter's features but also explain why they work. Through practical examples and real-world execution, you'll gain a deeper understanding of Flutter's inner workings. From crafting stunning UI/UX with widgets to leveraging hot reload and restart techniques, we'll equip you with best practices and invaluable knowledge. As you progress, you'll learn to efficiently manage data, add interactivity and animations, and integrate essential Flutter plugins like maps, camera, voice recognition and more. And let's not forget the dedicated chapter on implementing MLkit powered by TensorFlow Lite. We'll guide you through building custom machine learning solutions, expanding the capabilities of your apps. By the time you reach the end of this comprehensive Flutter book, you'll have the skills and confidence to write and deliver fully functional apps.

Who is this book for?

Developers who are familiar with the OOP language and prefer learning-by-doing will get the most out of this book. If you have some experience building apps on Flutter or have been playing around with the framework for some time now and have set eyes on developing mobile apps using Dart, then this book is for you.

What you will learn

  • Familiarize yourself with Dart fundamentals and set up your development environment
  • Efficiently track and eliminate code errors with proper tools
  • Create various screens using multiple widgets to effectively manage data
  • Craft interactive and responsive apps by incorporating routing, page navigation, and input field text reading
  • Design and implement a reusable architecture suitable for any app
  • Maintain control of your codebase through automated testing and developer tooling
  • Develop engaging animations using the necessary tools
  • Enhance your apps with ML features using Firebase MLKit and TensorFlow Lite
  • Successfully publish your app on the Google Play Store and the Apple App Store

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 31, 2023
Length: 712 pages
Edition : 2nd
Language : English
ISBN-13 : 9781803245430
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : May 31, 2023
Length: 712 pages
Edition : 2nd
Language : English
ISBN-13 : 9781803245430
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 103.97
50 Algorithms Every Programmer Should Know
€37.99
Flutter Cookbook, Second Edition
€33.99
Flutter for Beginners
€31.99
Total 103.97 Stars icon
Banner background image

Table of Contents

18 Chapters
Getting Started with Flutter Chevron down icon Chevron up icon
Creating Your First Flutter App Chevron down icon Chevron up icon
Dart: A Language You Already Know Chevron down icon Chevron up icon
Introduction to Widgets Chevron down icon Chevron up icon
Mastering Layout and Taming the Widget Tree Chevron down icon Chevron up icon
Adding Interactivity and Navigation to Your App Chevron down icon Chevron up icon
Basic State Management Chevron down icon Chevron up icon
The Future is Now: Introduction to Asynchronous Programming Chevron down icon Chevron up icon
Data Persistence and Communicating with the Internet Chevron down icon Chevron up icon
Advanced State Management with Streams Chevron down icon Chevron up icon
Using Flutter Packages Chevron down icon Chevron up icon
Adding Animations to Your App Chevron down icon Chevron up icon
Using Firebase Chevron down icon Chevron up icon
Firebase Machine Learning Chevron down icon Chevron up icon
Flutter Web and Desktop Chevron down icon Chevron up icon
Distributing Your Mobile App Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6
(39 Ratings)
5 star 82.1%
4 star 10.3%
3 star 0%
2 star 2.6%
1 star 5.1%
Filter icon Filter
Top Reviews

Filter reviews by




Giovanny Sep 14, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have learned so much with this book
Subscriber review Packt
Giovanny Sep 13, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have learned so much with this book. It's between my favorites books now
Subscriber review Packt
병옥 김 Jan 28, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Feefo Verified review Feefo
Alberto Acosta Nov 08, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
It is undoubtedly the best technical book publisher on the planet. And their approach to collaboration with their readers couldn't be better. I can't say enough about how grateful I am to PackPub for giving me access to the most advanced technologies year after year, year after year.
Feefo Verified review Feefo
Akash Matlani Jul 13, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very Useful & Detail Described.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.