Mastering Flutter helps the reader master the popular Flutter framework for rapid cross-platform app development.
Mobile applications grow in popularity every year, and developers keep looking for new tools to help them design them. A Google-backed, free and open-source mobile user interface framework, Flutter, stands out among these products.
Flutter enables developers to construct a native mobile app using just a single line of code. This implies that one could design two different applications using the same programming language and codebase (iOS and Android).
Flutter comprises two main components: a Framework and a Software Development Kit (SDK). You will use the Dart programming language to create Flutter apps. Dart is an object-oriented programming language with data types and its own paradigm.
The best part about Flutter is that you can use it to create apps for iOS, Android, desktop, and the web, all with the same codebase. Flutter comes with a widget-based UI library, a collection of UI elements (text boxes, picture blocks, buttons, and so on) that can be used to customize and construct apps. Consider Flutter to be the app’s frontend user interface and Dart to be the backend code that is generated automatically.
Flutter is considerably easier to understand and use, perfect for creating MVPs. It is also supported by a variety of Integrated Development Environments.
Long story short, Flutter is paving the way for the future. Several companies have already begun using Flutter for cross-platform development. In fact, even Ubuntu Linux supports Flutter-based desktop apps. As such, learning Flutter can be a career-defining move for any coder.
With Mastering Flutter, learning Flutter becomes straightforward, which will help readers undoubtedly advance their careers.
The Mastering Computer Science series is edited by Sufyan bin Uzayr, a writer and educator with over a decade of experience in the computing field.
Author(s): Sufyan bin Uzayr
Series: Mastering Computer Science
Publisher: CRC Press
Year: 2022
Language: English
Pages: 372
City: Boca Raton
Cover
Half Title
Series Page
Title Page
Copyright Page
Contents
Preface
About the Author
CHAPTER 1: Getting Started with Flutter and Dart
WHAT EXACTLY IS FLUTTER?
What Distinguishes Flutter
Flutter’s Features
Flutter Advantages
Flutter’s History
Prerequisites
Audience
Problems
INSTALLATION OF FLUTTER
Windows System Requirements
Install Git
Install the Flutter SDK
macOS System Requirements
Download the Flutter SDK
WHAT EXACTLY IS DART PROGRAMMING?
Dart: Language
Characteristics of Dart
Open Source
Platform Independent
Object-Oriented
Concurrency
Extensive Libraries
Easy to Learn
Flexible Compilation
Type Safe
Objects
Browser Support
Community
Dart’s Libraries
Dart: Platforms
Native Dart (Machine Code JIT and AOT)
Dart Web (JavaScript Dev and Prod)
Dart’s Runtime
A Fundamental Darts Program
Key Actions
Variables
Default Value
INSTALLATION OF DART
Install the Dart SDK on Windows
Install the Dart SDK on Linux
Installation Using apt-get
Installation of a Debian Package
Installation of the Dark SDK on Mac
Editor of Online Dart
Support of Dart IED
The dart2js Tool
First Program in Dart
Using Command Line
Running on Browser
Using IDE
Basic Dart Syntax
Dart Identifiers
String Interpolation and Dart Printing
Dart’s Semicolon
Line Breaks and Dart Whitespace
Block in Dart
Command-Line Options for Dart
Enable Checked Mode
Checked Mode
Production Mode
COMMENTS IN DART
Comments Types
Single-Line Comments
Multi-Line Comments
Documentation Comments
KEYWORDS IN DART
DATA TYPES IN DART
Dart Number
Data String
Dart Boolean
Dart Lists
Dart Maps
Dart Runes
Dart Symbols
Dart Dynamic Type
VARIABLE IN DART
Variable Creation Rule
Dart Variable Declaration
Type Annotations
Declaring the Variable as Having Multiple Values
Default Value
Final and Const
OPERATORS IN DART
Operator Types
Arithmetic Operators in Dart
Unary Operators (Post and Pre)
Assignment Operator
Relational Operator
Type Test Operators
Logical Operators
Bitwise Operators
Conditional Operators (?:)
Cascade Notation Operators
CHAPTER SUMMARY
CHAPTER 2: Data Types and Control Flow Statements
DART CONSTANTS
Defining/Initializing a Dart Constant
Using the Final Keyword, Define Constant
Define Constants Using Const Keyword
NUMBER IN DART
Dart Integer
Dart Double
Parse() Method in Dart
Number Properties
Number Methods
STRING IN DART
Printing String
String Concatenation
String Interpolation
String Properties
String Methods
Methods and Descriptions
LISTS IN DART
Lists Types
Fixed Length List
Growable List
List Properties
Inserting an Element into a List
The Add() Method
The AddAll() Method
The Insert() Method
The InsertAll() Method
Updating List
replaceRange()
Removing List Elements
The Remove() Method
The RemoveAt() Method
The RemoveLast() Method
The RemoveRange() Method
Dart Iterating List Elements
SETS IN DART
Initializing Set
Add Element into Set
Access the Set Element
Dart Finding Element in Set
Remove Set Element
Dart Iterating over a Set Element
Dart Remove All Set Element
TypeCast Set to List
Dart Set Operations
Dart Set Properties
MAP IN DART
Declaring Dart Map
Using Map Literals
Using Map Constructor
Map Properties
Map Methods
SYMBOL IN DART
Dart Convert Symbol to String
RUNES IN DART
String.codeUnitAt() Method
String.codeUnits Property
String.runes Property
ENUMERATION IN DART
Enumeration Initialization
CONTROL FLOW STATEMENT IN DART
Flow Statement Categories
Dart Decision-Making Statements
IF STATEMENTS
IF-ELSE STATEMENT
IF ELSE-IF STATEMENT
Nested If-Else Statement
SWITCH CASE STATEMENT
Benefits of the Switch Case
LOOPS IN DART
For Loop in Dart
Nested for Loop
For in Loop
While Loop
Infinite While Loop
Logical Operator While Loop
Do-While Loop
Selection of the Loop
BOOLEAN IN DART
CHAPTER SUMMARY
CHAPTER 3: Dart Functions and Object-Oriented Programming
FUNCTION IN DART
Function Benefits
Function Defining
Calling a Function
Passing Arguments to the Function
Return a Value from the Function
Function Examples
Dart Function with an Argument and a Return Value
Dart Function with No Parameter and Return Value
Dart Function with No Parameter and without a Return Value
Dart Function with Parameter and without a Return Value
ANONYMOUS FUNCTION IN DART
Lexical Scope
Lexical Closure
THE MAIN() FUNCTION
Return Value in Dart
Dart Value with Return Value
WHAT IS RECURSION?
What Is Base Condition in Recursion?
Recursive Function in Dart
How Does Recursion Work?
Recursive Function Qualities
OBJECT-ORIENTED CONCEPTS IN DART
Class
Object
Inheritance
Polymorphism
Interfaces
Abstract Class
DART CLASSES AND OBJECT
Defining a Class in Dart
Object in Dart
Creating Class Objects in Dart
Assessing Instance Variable and Function
The Advantages of Objects
WHAT EXACTLY IS CONSTRUCTOR?
Creating Constructor
Types of Constructors
Default Constructor or No-Argument Constructor
Parameterized Constructor
Named Constructors
THIS KEYWORD IN DART
Local Variables
Class Variable
Instance Variable
The Difference between Class Variable and Instance Variable
STATIC KEYWORD IN DART
Static Variable in Dart
Static Variable Declaring
Accessing the Static Variable
Static Method
Static Methods Declaration
Static Method Calling
SUPER KEYWORD
The Use of a Static Keyword
Using a Super Keyword with Variables
Using the Super Keyword with the Parent Class Method
Using a Super Keyword with the Constructor
INHERITANCE IN DART
Inheritance Types
Single Level Inheritance
Multilevel Inheritance
Hierarchical Inheritance
SUPER CONSTRUCTOR IN DART
Implicit Super
Explicit Super
METHODS IN DART
Instance Methods
Creating Instance Methods
Calling the Instance Method
Class Methods
Creating Class Methods
Calling the Class Method
METHOD OVERRIDING IN DART
What Exactly Is Polymorphism?
Example of Method Overriding
Method Overriding Using the Super Keyword
The Benefit of Method Overriding
Rules of Method Overriding in Dart
GETTERS AND SETTERS IN DART
Defining a Getter
Defining a Setter
ABSTRACT CLASSES IN DART
Rules for the Abstract Classes
Declaring the Abstract Class
Abstract Class Usage
DART INTERFACES
Declaring an Interface
Implementing an Interface
Implementing Multiple Inheritance
Rules for Implementing Interfaces
CHAPTER SUMMARY
CHAPTER 4: Dart Advanced
DART EXCEPTIONS
The Try/On/Catch Blocks
Finally Block
Throwing an Exception
Custom Exceptions
TYPEDEF IN DART
Declaring a Typedef
Assigning the Typedef Variable
Calling Function with Typedef
Complete the Program by Using Typedef
Typedef as Parameter
Debugging in Dart
What Exactly Are Breakpoints?
How Do I Create Breakpoints in WebStorm?
METADATA IN DART
Creating the Metadata Annotation
COLLECTION IN DART
Collections Iteration
HashMap
DART GENERICS
Generic Map
PACKAGES IN DART
Package Manager in Dart
Read XML String
LIBRARIES IN DART
Importing a Library
Importing and Using a Library as an Example
Library Encapsulation
Creating Custom Libraries (User-Defined Library)
Step 1: Library Declaration
Step 2: Library Connecting
Custom Library as an Example
Name Alias of Library
GENERATORS IN DART
Synchronous Generator
Asynchronous Generators
The Yield Keyword
The Sync* Keyword
The Async* Keyword
DART CALLABLE CLASSES
DART ISOLATES
Create and Start an Isolate
Stop an Isolate
Complete Program
ASYNC IN DART
Difference between Synchronous and Asynchronous
Dart Future
Dart Async and Await
Dart Await Keyword
What Exactly Is Concurrency?
How Does One Achieve Concurrency?
What Is Unit Testing?
Unit Testing Task
Advantages of Unit Testing
Dart Unit Testing
Group of Test Cases
Grouping Test Cases
DART HTML DOM
Finding the DOM Elements
Event Handling
CHAPTER SUMMARY
CHAPTER 5: Basics of Flutter
FIRST APPLICATION IN FLUTTER
FLUTTER ARCHITECTURE
Flutter Engine
Foundation Library
Widgets
Specific Widgets Design
Gestures
State Management
Layers
FLUTTER WIDGETS
WIDGET TYPES
Visible Widget
Text
Button
Image
Icon
Invisible Widget
Column
Row
Center
Padding
Scaffold
Stack
State Management Widget
StatefulWidget
StatelessWidget
FLUTTER LAYOUTS
Layout a Widget
Sorts of Layout Widgets
Single Child Widgets
Multiple Child Widgets
Building the Complex Layout
GESTURES IN FLUTTER
Pointers
Gestures
Tap
Drag
Long Press
Pan
Pinch
Gesture Detector
Example of Multiple Gesture
STATE MANAGEMENT
What Exactly Is a State?
Ephemeral State
App State
FLUTTER IDE
Android Studio
IntelliJ Idea
Visual Studio Code
Emacs (Dart Mode)
Codemagic
FLUTTER SCAFFOLD
FLUTTER CONTAINER
Why Is a Container Widget Required in Flutter?
Container Class Constructors
Container Widget Properties
FLUTTER ROW AND COLUMN
Row Widget
Column
FLUTTER TEXT
Text Widget Constructor
Flutter RichText Widget
FLUTTER TEXTFIELD
BUTTONS IN FLUTTER
Flutter Buttons and Their Varieties
Flat Button
Raised Button
Floating Activity Button (FAB)
The Drop-Down Button
Button Icon
Inkwell Button
PopupMenu Button
Outline Button
FLUTTER FORMS
Creating a Form
Validation of a Form
ICONS IN FLUTTER
Icon Widget Attributes
IMAGES IN FLUTTER
How to Display Images in Flutter
Display Images from the Internet
FLUTTER LISTS
Basic Lists
Working with Long Lists
Creating Grid Lists
Creating a Horizontal List
FLUTTER TOAST NOTIFICATION
FlutterToast.cancel()
CHECKBOX IN FLUTTER
Checkbox
FLUTTER RADIO BUTTON
PROGRESS BAR IN FLUTTER
LinearProgressIndicator
CircularProgressIndicator
FLUTTER SLIDER
Properties of Slider
How Does the Slider Widget Work in Flutter?
FLUTTER SWITCH
Properties of the Switch Widget
CHARTS IN FLUTTER
Flutter Supported Chart Types
Line Chart
Bar Chart
Pie or Donut Chart
FLUTTER TABLE
What Happens When We Utilize the Table Widget?
FLUTTER CALENDAR
CHAPTER SUMMARY
APPRAISAL
BIBLIOGRAPHY
INDEX