Core Syntax for Darts
Dart core syntax is the set of basics every program uses: declaring variables with var, final and const, working with built-in types such as int, double, String and List, writing if, for and switch statements, and defining functions with named and optional parameters. It is the first stage of the language.
Stage: Basics · Part of the Dart roadmap · Last reviewed 19 November 2026
What to learn in Core Syntax
- Declare variables with var, final and const and explain how they differ
- Use type inference and explicit types for numbers, strings, lists, sets and maps
- Write functions with positional, named and default parameters
- Use arrow syntax for single-expression functions
- Control flow with if, for-in, while and switch expressions
- Interpolate values into strings with the dollar sign syntax
Core Syntax interview questions
What is the difference between final and const in Dart?
A final variable can be assigned only once, but its value is decided at run time. A const variable is a compile-time constant, so its value must be known before the program runs, and const objects are canonicalised and deeply immutable.
How do named parameters work in a Dart function?
Named parameters are wrapped in curly braces and passed by name, such as greet(name: 'Asha'). They are optional unless marked required, and optional ones need a default value or a nullable type. They make calls with many arguments easier to read.
Where Core Syntax fits in the Dart roadmap
Core Syntax belongs to the Basics stage (beginner level). First programs.