0PricingLogin
Dart Academy · Lesson

Positional vs Named Parameters

Call functions with clear, ordered or labeled args.

Two Ways to Pass Args

Dart offers two parameter styles: positional and named. Picking the right one makes your function calls clearer and harder to misuse.

Positional Parameters

Positional parameters are matched by order. The first value fills the first slot, the second fills the second, and so on.

int sub(int a, int b) {
  return a - b;
}
sub(10, 3); // 7

All lessons in this course

  1. Declaring Functions and Return Types
  2. Positional vs Named Parameters
  3. Default Values and required
  4. Functions as First-Class Values
← Back to Dart Academy