Dart lessons
Flutter's language
Dart was developed by Google in 2011, but experienced its true rise in 2017 with Flutter. Flutter is a UI framework capable of producing iOS, Android, web, and desktop apps from a single codebase, and its language is Dart.
There is a technical reason for choosing Dart for Flutter: it supports both just-in-time and ahead-of-time compilation. During development, thanks to just-in-time compilation, changes appear on the screen the moment you modify the code — this "hot reload" feature is a huge speed boost in mobile development. When going to production, however, the code is compiled ahead-of-time into machine code and the app launches quickly.
As a language, Dart immediately feels familiar to anyone who knows Java and C#: class-based, statically typed, with curly braces. Null safety is baked into the language's type system, meaning you have to explicitly declare if a variable can be null.
- •→
Introduction to Dart
First step into modern Dart, the language of Flutter: the main function, printing with print, and comments.
- •→
Variables
Variable declaration using var, final, and explicit types; constants and reassignment.
- •→
Data Types
Basic types like int, double, String, bool; type inference and text↔number conversion.
- •→
Operators
Math (+ - * / ~/ %), comparison (== != < >), and logical (&& || !) operators.
- •→
Strings
Concatenation, interpolation, length, case conversion, and slicing methods.
- •→
Lists
List creation, element access, appending, length, and iterating with a loop.
- •→
Conditions (if / else)
Decision making with if-else if-else, branching using comparison and logical operators.
- •→
Loops (for / while)
Counting with for, iterating over lists with for-in, conditional repetition with while.
- •→
Functions
Function definition, parameters, return, arrow (=>) shorthand syntax, and default values.
What you will learn
- Printing output with print and using var and final
- Basic types and null safety
- Storing data with lists and maps
- Writing functions, named and optional parameters
- Classes, constructors, and inheritance
- Executing asynchronous work with Future and async-await
Who is this for?
- Those who want to develop mobile apps with Flutter
- Developers targeting both iOS and Android with a single codebase
- Those who know Java or C# and want to transition to mobile
When to use?
Dart is a mandatory and highly efficient choice for developing mobile, web, and desktop apps with Flutter; it is one of the most mature options for teams wanting to ship to multiple platforms with a single codebase.
Outside of Flutter, Dart's use case is limited. While server-side is possible, the ecosystem is not as broad as Node.js or Go; it is not suitable for data science.
Frequently asked questions
Is Flutter required to learn Dart?
No, you can learn the language on its own and run the examples on this site right in your browser. But in practice, almost everyone who learns Dart learns it for Flutter; transitioning to Flutter without mastering the language just turns into copy-pasting code snippets.
Flutter or React Native?
Flutter renders its own user interface with its own drawing engine, so it looks identical on both platforms and its performance is generally higher. React Native, on the other hand, uses the platform's native UI components and the transition is easier for those who know JavaScript. If you are ready to learn Dart, Flutter provides more consistent results for most teams.
What is null safety?
The possibility of a variable holding no value is part of the type: if you write String it cannot be null, if you write String? it can be. If you try to directly access a nullable value, the code won't compile. This shifts the most common cause of crashes in mobile apps to the compilation phase.
What is a Future?
It is a representation of an operation whose result is not yet ready — such as a server request, file read, or timer. You wait for the result with await; during this time the app does not freeze. In mobile apps, all network operations run through Futures.
Summary
Dart is the language for developing multi-platform apps from a single codebase with Flutter; it is quick to learn with its familiar syntax and null safety. In this tutorial, we progress from basic types to classes and asynchronous programming.