Dart Function Named Parameters

Dart Function Named Parameters

·

1 min read

Named Parameters

  • Named parameters are optional unless they're explicitly marked as required.

  • When defining a function, use {param1, param2, …} to specify named parameters. If you don't provide a default value or mark a named parameter as required, their types must be nullable as their default value will be null:

    dart

  •   /// Sets the [bold] and [hidden] flags ...
      void enableFlags({bool? bold, bool? hidden}) {...}