100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Dart Cheat Sheet

Dart Cheat Sheet

Dart syntax, sound null safety, async programming, and collection methods used to build Flutter applications.

2 PagesIntermediateApr 8, 2026

Basic Syntax

Variables, control flow, and printing.

dart
void main() {  int age = 30;  var name = "Ada";           // type inferred as String  const pi = 3.14159;  bool isFun = true;  if (age >= 18) {    print("$name is an adult");  }  for (int i = 0; i < 5; i++) {    print("Count: $i");  }}

Null Safety

Sound null safety operators and late init.

dart
String? middleName;             // nullable typemiddleName ??= "default";       // assign only if nullprint(middleName?.length);      // safe navigationint? maybeAge;int age = maybeAge ?? 0;        // null-coalescing operatorlate String description;        // initialized before first usedescription = "computed later";

Async & Futures

Asynchronous programming with Future/async/await.

dart
Future<String> fetchData() async {  await Future.delayed(Duration(seconds: 1));  return "data";}void main() async {  print("Fetching...");  String result = await fetchData();  print(result);  fetchData().then((value) => print(value)).catchError((e) => print(e));}

Collection Methods

Common Iterable/List operations.

  • .map()- transforms each element, returns a lazy Iterable
  • .where()- filters elements matching a predicate
  • .reduce()- combines elements into a single value
  • .toList() / .toSet()- materializes an Iterable into a concrete collection
  • .firstWhere()- returns the first matching element or throws/orElse
  • spread operator (...)- inlines one collection's elements into a list/set/map literal
Pro Tip

Use the `late` keyword sparingly — it defers null-safety checks to runtime, so prefer nullable types with `??` when a default value is reasonable.

Was this cheat sheet helpful?

Explore Topics

#Dart#DartCheatSheet#Programming#Intermediate#BasicSyntax#NullSafety#AsyncFutures#CollectionMethods#Functions#DataStructures#Concurrency#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech

Professional Web Designing Services

  • Responsive Websites
  • E-commerce Solutions
  • SEO Friendly Design
  • Fast & Secure
  • Support & Maintenance
Get a Free Quote

Share this Cheat Sheet