> For the complete documentation index, see [llms.txt](https://meulencv.gitbook.io/flutter-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://meulencv.gitbook.io/flutter-documentation/dart/functions.md).

# Functions

A function allows you to call a code from a shorter one, and in this way allows you to reuse code.

## Positional:

```dart
void name (String message, int lineNum) {
  // ...
}
```

```dart
name (String message, int lineNum) {
  return // ...
}
```

Calling the function:

```
name ('text', 55);
```

## Named:

```dart
void name ({String message, int lineNum}) {
//...
}
```

<pre class="language-dart"><code class="lang-dart">name ({String message, int lineNum}) {
<strong>return //...
</strong>}
</code></pre>

Calling the function:

```dart
name (message: 'A bug!', lineNum: 44);
```

{% embed url="<https://flutterbyexample.com/lesson/function-arguments-default-optional-named>" %}
