Pragmatic Flutter
eBook - ePub

Pragmatic Flutter

Building Cross-Platform Mobile Apps for Android, iOS, Web & Desktop

Priyanka Tyagi

Share book
  1. 370 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Pragmatic Flutter

Building Cross-Platform Mobile Apps for Android, iOS, Web & Desktop

Priyanka Tyagi

Book details
Book preview
Table of contents
Citations

About This Book

Have you ever thought of creating beautiful, blazing-fast native apps for iOS and Android from a single codebase? Have you dreamt of taking your native apps to the web and desktop without it costing a fortune? If so, Pragmatic Flutter: Building Cross-Platform Mobile Apps for Android, iOS, Web & Desktop is the right place to start your journey to developing cross-platform apps. Google's Flutter is the brand-new way for developing beautiful, fluid, and blazing-fast cross-platform apps for Android, iOS, web, and desktops (macOS, Linux, Windows).

Google's new Fuchsia OS user interface (UI) is implemented using Flutter as well. Learning to develop mobile apps with Flutter opens the door to multiple devices, form-factors, and platforms using a single codebase. You don't need any prior experience using Dart to follow along in this book; however, it's recommended that readers have some familiarity with writing code using one of the object-oriented programming languages.

Your journey starts with learning to structure and organize the Flutter project to develop apps for multiple platforms. Next, you will explore the fundamentals of Flutter widgets. The journey continues with Flutter's layout widgets while also learning to build responsive layouts. You will get an understanding of organizing and applying themes and styles, handling user input, and gestures. Then you will move on to advanced concepts, such as fetching data over the network and integrating and consuming REST API in your app. You will get hands-on experience on design patterns, data modeling, routing, and navigation for multi-screen apps. When you are finished, you will have a solid foundational knowledge of Flutter that will help you move on to building great and successful mobile apps that can be deployed to Android, iOS, web, and desktop (macOS, Linux, Windows) platforms from a single codebase.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Pragmatic Flutter an online PDF/ePUB?
Yes, you can access Pragmatic Flutter by Priyanka Tyagi in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Mobile Devices. We have over one million books available in our catalogue for you to explore.

Information

Publisher
CRC Press
Year
2021
ISBN
9781000427103
Edition
1

1

Dart Fundamentals

A Quick Reference to Dart 2
Dart programming language is developed by Google. It has been around since 2011. However, it has gained popularity recently since Google announced Flutter software development kit (SDK) for developing cross-platform-applications. Dart aims to help developers build web and mobile applications effectively. It works for building production-ready solutions for client applications as well as for the server-side. Dart has an Ahead-of-Time (AOT) compiler that compiles predictable native code quickly for the target platform. It is optimized to build customized user interfaces natively for multiple platforms. The Dart is a developers-friendly programming language. It is easy for developers coming from different programming language backgrounds to learn Dart without much effort.
The Dart 2 (Announcing Dart 2 Stable and the Dart Web Platform) is the latest version of Dart language including the rewrite of many features, improved performance and productivity. This chapter covers the basics of Dart 2 language syntaxes (Google, 2020) to get started with the journey of building applications using Flutter. A prior understanding of object-oriented programming is needed to follow along with the material. Dart 2 and Dart will be used to infer the Dart 2 programming language in this book. In the upcoming topics, we'll review some of the language features with the help of examples.

THE main FUNCTION

The `main()` function is the entry point for any Dart program. The following code snippet will print “Hello Dart” on the console. Open a ‘Terminal’ at MacOS or its Windows or Linux equivalent. Create a file say ‘hello.dart’, and copy the following code snippet in it.
```
void main() {
print("Hello Dart");
}
```

RUNNING DART PROGRAM

Go back to the ‘Terminal’ and execute the file using `dart hello.dart`. The “Hello Dart” is printed on the console.
```
$ dart hello.dart
Hello Dart
```

VARIABLES & DATA TYPES

In Dart, you can use the `var` keyword to infer the underlying data type. The following code snippet shows declaring variable `data` to hold the numeric value ‘1’.
```
var data = 1;
print(data);
```
The above code snippet will print the ‘1’ on the console. The runtimeType (runtimeType property) property gives the runtime type of the object it's called on. The following code snippet will print the data type of the `data` variable as ‘int’ on the console.
```
var data = 1;
print(data.runtimeType);
```
It's valid for the `data` variable to get reassigned to a value from a different data type.
There's another keyword, `dynamic`, to assign a value to a variable similar ...

Table of contents