fluttercommunity / fluttercommunity/flutter-styleguide

Unused parameters in a method should be replaced with an underscore

Open
#1 1 comment 4 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
56
Forks
3
PR merge metrics
No merged PRs in 30d

Description

When providing a closure that accepts parameters for which you don't need to provide a value, it is recommended that you use the underscore/underbar character (_). For example, when creating routes in MaterialApp, you specify a context. Don't do this:
```dart
routes: {
'/', (context) => SomeWidget(),
'/route2': (context) => Widget2(),
}
```
Do:
```dart
routes: {
'/', (_) => SomeWidget(),
'/route2': (_) => Widget2(),
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.