Optional positional parameters live in [...]. They keep call sites short when the extra value has a natural default, but callers can still pass the value by position when they need different behavior.

Program

Play the program to call one formatter with its default suffix and again with an explicit suffix.

optional_positional.dart
String label(String name, [String suffix = '!']) {
  return '$name$suffix';
}

void main() {
  var name = ;
  var normal = label(name);
  var excited = label(name, '!!');
  print('$normal / $excited');
}
String label(String name, [String suffix = '!']) {
  return '$name$suffix';
}

void main() {
  var name = ;
  var normal = label(name);
  var excited = label(name, '!!');
  print('$normal / $excited');
}
String label(String name, [String suffix = '!']) {
  return '$name$suffix';
}

void main() {
  var name = ;
  var normal = label(name);
  var excited = label(name, '!!');
  print('$normal / $excited');
}
optional positional `[String suffix = '!']` makes the second argument optional while keeping positional call syntax.
default value `label(name)` uses the default suffix because the caller passes only the required `name`.
explicit value `label(name, '!!')` overrides the default by passing the optional argument in the second position.