# Dart Explained: Google's Language Behind Flutter

## Introduction

Dart is Google's language for building apps, and it is best known as the language of Flutter — the framework that builds apps for phones, web, and desktop from one codebase. But Dart is worth understanding on its own: it is a modern, typed language with one of the clearest approaches to missing values and asynchronous code in any mainstream language.

## Sound null safety: the compiler guarantees it

Dart's null safety is "sound": if the compiler says your code is null-safe, it really is — no runtime surprises. Like Kotlin and Swift, Dart marks nullable types with `?`:

```
void main() {
  String name = "Sara";
  // name = null; // Error: null is not a String
  String? nickname = null;
  print(nickname?.length); // null, no crash
  print(nickname ?? "No nickname"); // "No nickname"
}
```

The `?.` safe-call operator and `??` fallback operator work exactly as in Kotlin. The difference is the guarantee: Dart's compiler proves null safety at compile time, so null crashes are not just rarer — in sound-null-safe code, they cannot happen from ordinary mistakes.

## Async built into the language

Dart was designed for user interfaces, where waiting must never freeze the screen. Its async model will feel familiar from JavaScript's async/await, but with a typed twist — a `Future` is Dart's promise of a value later:

```
Future<String> fetchGreeting() async {
  await Future.delayed(Duration(seconds: 1));
  return "Hello, Sara!";
}
void main() async {
  String greeting = await fetchGreeting();
  print(greeting);
}
```

`async` marks a function that waits, `await` pauses without blocking, and `Future<String>` tells you exactly what type will arrive. The same pattern powers every network call and file read in a Flutter app.

## Two ways to run: native and web

Dart compiles in two directions, which is why Flutter can target so many platforms. Ahead-of-time (AOT) compilation produces fast native code for phones and desktop; just-in-time (JIT) compilation powers hot reload during development, where changes appear in a running app in under a second. And Dart also compiles to JavaScript for the web. One language, one codebase, and the compiler picks the right output for each target.

## Takeaway

Sound null safety that the compiler guarantees, async with typed Futures, and compilation to native or web from one codebase. Dart is the quiet foundation under Flutter — and understanding it makes Flutter's code far less mysterious.

Originally published at https://practicaldevblog.blogspot.com/2026/10/dart-explained-googles-language-behind.html
