Cheat Sheets

Dart Cheat Sheet (2026): Types, Null Safety, Async & Collections

By ArpaNeuro Team September 24, 2026
Dart cheat sheet Flutter

Dart is the language Flutter uses: sound null safety (String vs String?), type inference (var, final), collections, and async/await on Futures. Learn Dart types and nulls before you memorize widget catalogs. The same language runs in Flutter tests and small CLI tools.

This Dart cheat sheet is written for people searching for a fast, accurate reference: students, junior developers, and teams shipping production software. Pin it, copy the snippets, and come back when syntax slips.

Quick reference

  • final / const: final runtime once. const compile-time. var infers a mutable binding.
  • Null: int? n. Use n ?? 0, n?.abs(), n! only when you know it is non-null.
  • late: Assigned before first read. Do not use late to hide missing initialization.
  • Collections: <int>[], <String, int>{}, list.where((x) => x > 0).toList().
  • Functions: int add(int a, int b) => a + b; named args {required this.title}.
  • async: Future<String> load() async { return await http.get(...); }.
  • Stream: Many async values. Flutter uses streams in some plugins; StreamBuilder in UI.
  • class: Constructors, named constructors, factory. Mixins with with.

Copy-paste examples

Null-safe parse and a Future

int.tryParse returns int?. Keep ! out of app code unless a failed parse is already impossible.

int parseQty(String? raw) {
  final n = int.tryParse(raw ?? '');
  return n == null || n < 0 ? 0 : n;
}

Future<String> loadTitle(int id) async {
  await Future<void>.delayed(const Duration(milliseconds: 10));
  return 'Project $id';
}

Common mistakes

  • Using ! on every nullable to “make the analyzer quiet.”
  • Mixing Future without await and printing Instance of Future.
  • Mutable var lists in const widgets — const requires const children.
  • Treating Dart as JavaScript (no undefined; use null).

FAQ

  1. Is Dart only for Flutter? Most jobs that mention Dart mean Flutter. Dart also runs on the VM for tools and servers, but the ecosystem is Flutter-heavy.
  1. var vs final vs const? var reassignable inferred type. final one assignment. const compile-time constant objects (canonicalized).
  1. How is Dart typed? Sound static types with inference. At runtime, types are still there (unlike TypeScript erase-only) for many checks — but you still write null-safe code for the compiler.

Build with this stack

When a cheat sheet is not enough — you need a production app, a student FYP, or a custom dashboard — ArpaNeuro builds mobile app development and also sells ready-made source code. Request a quote and tell us the stack.

Browse software development services or the source code marketplace if you want a working codebase instead of starting from a blank file.

← All Articles Get a Quote →