ebook img

Flutter Recipes: Mobile Development Solutions for iOS and Android PDF

550 Pages·2019·7.072 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Flutter Recipes: Mobile Development Solutions for iOS and Android

Flutter Recipes Mobile Development Solutions for iOS and Android — Fu Cheng Flutter Recipes Mobile Development Solutions for iOS and Android Fu Cheng Flutter Recipes: Mobile Development Solutions for iOS and Android Fu Cheng Sandringham, Auckland, New Zealand ISBN-13 (pbk): 978-1-4842-4981-9 ISBN-13 (electronic): 978-1-4842-4982-6 https://doi.org/10.1007/978-1-4842-4982-6 Copyright © 2019 by Fu Cheng This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Aaron Black Development Editor: James Markham Coordinating Editor: Jessica Vakili Cover image designed by Freepik (www.freepik.com) Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail [email protected], or visit http://www. apress.com/rights-permissions. Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at http://www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book’s product page, located at www.apress.com/ 978-1-4842-4981-9. For more detailed information, please visit http://www.apress.com/ source-code. Printed on acid-free paper Table of Contents About the Author �����������������������������������������������������������������������������xxxi About the Technical Reviewer �������������������������������������������������������xxxiii Chapter 1: Get Started ��������������������������������������������������������������������������1 1-1. Installing Flutter SDK on Windows.................................................................1 Problem ...........................................................................................................1 Solution ...........................................................................................................1 Discussion .......................................................................................................1 1-2. Installing Flutter SDK on Linux ......................................................................4 Problem ...........................................................................................................4 Solution ...........................................................................................................4 Discussion .......................................................................................................4 1-3. Installing Flutter SDK on macOS ....................................................................5 Problem ...........................................................................................................5 Solution ...........................................................................................................6 Discussion .......................................................................................................6 1-4. Setting Up iOS Platform .................................................................................7 Problem ...........................................................................................................7 Solution ...........................................................................................................7 Discussion .......................................................................................................7 1-5. Setting Up iOS Simulators .............................................................................9 Problem ...........................................................................................................9 Solution ...........................................................................................................9 Discussion .......................................................................................................9 iii TTaabbllee ooff CCoonnTTeennTTss 1-6. Setting Up iOS Devices ..................................................................................9 Problem ...........................................................................................................9 Solution ...........................................................................................................9 Discussion .....................................................................................................10 1-7. Setting Up Android Platform ........................................................................11 Problem .........................................................................................................11 Solution .........................................................................................................11 Discussion .....................................................................................................11 1-8. Setting Up Android Emulators ......................................................................13 Problem .........................................................................................................13 Solution .........................................................................................................13 Discussion .....................................................................................................13 1-9. Setting Up Android Devices .........................................................................18 Problem .........................................................................................................18 Solution .........................................................................................................18 Discussion .....................................................................................................18 1-10. Creating Flutter Apps Using Command Line ..............................................19 Problem .........................................................................................................19 Solution .........................................................................................................19 Discussion .....................................................................................................19 1-11. Creating Flutter Apps Using Android Studio ...............................................20 Problem .........................................................................................................20 Solution .........................................................................................................20 Discussion .....................................................................................................20 1-12. Creating Flutter Apps Using VS Code .........................................................24 Problem .........................................................................................................24 Solution .........................................................................................................24 Discussion .....................................................................................................25 iv TTaabbllee ooff CCoonnTTeennTTss 1-13. Running Flutter Apps .................................................................................26 Problem .........................................................................................................26 Solution .........................................................................................................26 Discussion .....................................................................................................26 1-14. Understanding Code Structure of Flutter Apps ..........................................27 Problem .........................................................................................................27 Solution .........................................................................................................27 Discussion .....................................................................................................27 1-15. Fixing Configuration Issues of Flutter SDK ................................................28 Problem .........................................................................................................28 Solution .........................................................................................................28 Discussion .....................................................................................................28 1-16. Summary ...................................................................................................28 Chapter 2: Know the Tools ������������������������������������������������������������������29 2-1. Using Dart Observatory ...............................................................................29 Problem .........................................................................................................29 Solution .........................................................................................................29 Discussion .....................................................................................................29 2-2. Using Hot Reload and Hot Restart ...............................................................31 Problem .........................................................................................................31 Solution .........................................................................................................31 Discussion .....................................................................................................32 2-3. Upgrading Flutter SDK .................................................................................34 Problem .........................................................................................................34 Solution .........................................................................................................34 Discussion .....................................................................................................35 v TTaabbllee ooff CCoonnTTeennTTss 2-4. Debugging Flutter Apps in Android Studio ...................................................36 Problem .........................................................................................................36 Solution .........................................................................................................36 Discussion .....................................................................................................36 2-5. Viewing Outline of Flutter Apps in Android Studio .......................................39 Problem .........................................................................................................39 Solution .........................................................................................................39 Discussion .....................................................................................................40 2-6. Debugging Flutter Apps in VS Code .............................................................41 Problem .........................................................................................................41 Solution .........................................................................................................41 Discussion .....................................................................................................41 2-7. Creating Flutter Projects ..............................................................................42 Problem .........................................................................................................42 Solution .........................................................................................................42 Discussion .....................................................................................................43 2-8. Running Flutter Apps ...................................................................................46 Problem .........................................................................................................46 Solution .........................................................................................................46 Discussion .....................................................................................................46 2-9. Building Flutter App Binaries .......................................................................51 Problem .........................................................................................................51 Solution .........................................................................................................51 Discussion .....................................................................................................51 2-10. Installing Flutter Apps ................................................................................53 Problem .........................................................................................................53 Solution .........................................................................................................53 Discussion .....................................................................................................53 vi TTaabbllee ooff CCoonnTTeennTTss 2-11. Managing Packages ..................................................................................54 Problem .........................................................................................................54 Solution .........................................................................................................54 Discussion .....................................................................................................54 2-12. Running Flutter Tests .................................................................................56 Problem .........................................................................................................56 Solution .........................................................................................................56 Discussion .....................................................................................................56 2-13. Analyzing the Code ....................................................................................58 Problem .........................................................................................................58 Solution .........................................................................................................59 Discussion .....................................................................................................59 2-14. Managing Emulators ..................................................................................61 Problem .........................................................................................................61 Solution .........................................................................................................61 Discussion .....................................................................................................61 2-15. Taking Screenshots ...................................................................................62 Problem .........................................................................................................62 Solution .........................................................................................................62 Discussion .....................................................................................................62 2-16. Attaching to Running Apps ........................................................................63 Problem .........................................................................................................63 Solution .........................................................................................................63 Discussion .....................................................................................................64 2-17. Tracing Running Flutter Apps .....................................................................65 Problem .........................................................................................................65 Solution .........................................................................................................65 Discussion .....................................................................................................65 vii TTaabbllee ooff CCoonnTTeennTTss 2-18. Configuring Flutter SDK .............................................................................66 Problem .........................................................................................................66 Solution .........................................................................................................66 Discussion .....................................................................................................66 2-19. Showing App Logs .....................................................................................67 Problem .........................................................................................................67 Solution .........................................................................................................67 Discussion .....................................................................................................68 2-20. Formatting Source Code ............................................................................68 Problem .........................................................................................................68 Solution .........................................................................................................69 Discussion .....................................................................................................69 2-21. Listing Connected Devices ........................................................................70 Problem .........................................................................................................70 Solution .........................................................................................................70 Discussion .....................................................................................................70 2-22. Running Integration Tests ..........................................................................70 Problem .........................................................................................................70 Solution .........................................................................................................71 Discussion .....................................................................................................71 2-23. Enabling Bash Completion of Flutter SDK Commands ...............................72 Problem .........................................................................................................72 Solution .........................................................................................................72 Discussion .....................................................................................................72 2-24. Cleaning Build Files of Flutter Apps ...........................................................74 Problem .........................................................................................................74 Solution .........................................................................................................74 Discussion .....................................................................................................74 viii TTaabbllee ooff CCoonnTTeennTTss 2-25. Managing Flutter SDK Cache .....................................................................74 Problem .........................................................................................................74 Solution .........................................................................................................74 Discussion .....................................................................................................75 2-26. Summary ...................................................................................................75 Chapter 3: Essential Dart ��������������������������������������������������������������������77 3-1. Understanding Built-In Types .......................................................................77 Problem .........................................................................................................77 Solution .........................................................................................................77 Discussion .....................................................................................................77 3-2. Using Enumerated Types .............................................................................81 Problem .........................................................................................................81 Solution .........................................................................................................81 Discussion .....................................................................................................82 3-3. Using Dynamic Type ....................................................................................83 Problem .........................................................................................................83 Solution .........................................................................................................83 Discussion .....................................................................................................83 3-4. Understanding Functions .............................................................................84 Problem .........................................................................................................84 Solution .........................................................................................................84 Discussion .....................................................................................................84 3-5. Using Typedefs ............................................................................................86 Problem .........................................................................................................86 Solution .........................................................................................................86 Discussion .....................................................................................................86 ix

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.