Practical Flutter Improve your Mobile Development with Google’s Latest Open-Source SDK — Frank Zammetti www.allitebooks.com Practical Flutter Improve your Mobile Development with Google’s Latest Open-Source SDK Frank Zammetti www.allitebooks.com Practical Flutter: Improve your Mobile Development with Google’s Latest Open-Source SDK Frank Zammetti Pottstown, PA, USA ISBN-13 (pbk): 978-1-4842-4971-0 ISBN-13 (electronic): 978-1-4842-4972-7 https://doi.org/10.1007/978-1-4842-4972-7 Copyright © 2019 by Frank Zammetti 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: Louise Corrigan Development Editor: James Markham Coordinating Editor: Nancy Chen Cover designed by eStudioCalamar 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 orders-ny@springer- sbm.com, 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/9781484249710. For more detailed information, please visit http://www.apress.com/source-code. Printed on acid-free paper www.allitebooks.com I’d like to dedicate this book to butterflies, which flutter in the wind. No, wait, that’s too easy. I’d like to dedicate this book to gamblers who, the British people might say, make “a flutter on the horses.” Yes, that’s actually a real usage of the word flutter, but that too is too easy. No, I’d like to dedicate this book to all the unknowns the human race has yet to discover and, in some cases, create. I am a pessimist by nature, but I fight that nature each and every day because I also recognize that the universe is a wondrous place and, despite what the evening news tells us, the human race is capable of great beauty and wondrous creation. And, with my stated goal of being immortal, because death just isn’t me – it’s been done before, so I’m just gonna go ahead and skip it – I look forward to seeing it all! www.allitebooks.com Table of Contents About the Author ..................................................................................................... xi About the Technical Reviewer ............................................................................... xiii Acknowledgments ...................................................................................................xv Introduction ...........................................................................................................xvii Chapter 1: Flutter: A Gentle Introduction .................................................................. 1 Meditations on the Abyss .............................................................................................................. 1 What’s in a (Silly) Name? .............................................................................................................. 3 Dart: Language of the Gods? ......................................................................................................... 5 Widgets to the Left of Me, Widgets to the Right! ........................................................................... 8 Brass Tacks: The Pros and Cons of Flutter .................................................................................. 13 Ok, Enough Talk, Let’s Get Going with Flutter! ............................................................................ 17 Flutter SDK ............................................................................................................................ 17 Android Studio ....................................................................................................................... 19 The (Slightly Less) Typical “Hello, World!” App ............................................................................ 20 Hot Reload: You’ll Love It! ............................................................................................................ 29 Basic Flutter Application Structure ............................................................................................. 31 A Few More “Under-the-Covers” Details ..................................................................................... 35 Summary .................................................................................................................................... 36 Chapter 2: Hitting the Bullseye with Dart ............................................................... 37 The Things You Must Know ......................................................................................................... 38 No Comment: All About Comments ........................................................................................ 39 Nothing Stays the Same: Variables ........................................................................................ 41 Everybody Has a Type: Data Types ......................................................................................... 44 v www.allitebooks.com TABLE OF CONtENtS When a Single Value Just Won’t Do: Enumerations ............................................................... 50 What’s Your Type: The “as” and “is” Keywords ..................................................................... 51 Going with the Flow: Flow Control (and Logic!) Constructs ................................................... 51 The Big Nothing: void ............................................................................................................ 54 Smooth Operators ................................................................................................................. 55 Classing the Joint Up: Object Orientation in Dart .................................................................. 58 Getting Funky with Functions ................................................................................................ 67 Tell Me Is It So: Assertions ..................................................................................................... 71 Out of Time: Asynchrony ........................................................................................................ 71 Ssshhh, Be Quiet: Libraries (and Visibility) ............................................................................ 73 Let’s Be Exceptional: Exception Handling .............................................................................. 74 I Have the Power: Generators ................................................................................................ 76 Metatude: Metadata .............................................................................................................. 78 Speaking in General: Generics ............................................................................................... 79 Summary .................................................................................................................................... 80 Chapter 3: Say Hello to My Little Friend: Flutter, Part I .......................................... 83 A Buffet of Widgets ..................................................................................................................... 84 Layout .................................................................................................................................... 84 Navigation ............................................................................................................................. 97 Input ...................................................................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages407 Page
-
File Size-