Skip to content

Unused parameters in a method should be replaced with an underscore #1

@rapPayne

Description

@rapPayne

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:

routes: {
  '/', (context) => SomeWidget(),
  '/route2': (context) => Widget2(),
}

Do:

routes: {
  '/', (_) => SomeWidget(),
  '/route2': (_) => Widget2(),
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions