dart function as optional parameter code example
Example: dart optional parameters
Curly brackets {} are used to specify optional, named parameters in Dart.
readFile(String name, {String mode, String charset = 'utf-8'}) {
}
Named parameters are referenced by name,
which means that they can be used during the function
invocation in an order different from the function declaration.
readFile('hello.dart');
readFile('hello.dart', mode: 'w+');
readFile('hello.dart', charset: 'iso8859-1');
readFile('hello.dart', charset: 'iso8859-1', mode: 'w+');
readFile('hello.dart', mode: 'w+', charset: 'iso8859-1');