Skip to content
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
This repository was archived by the owner on Jul 16, 2023. It is now read-only.

[New rule] prefer-define-hero-tag #1027

Closed
@lsaudon

Description

@lsaudon

Please describe what the rule should do:

Please describe what the rule should do:
The rule should tell us to give a heroTag to the widget that supports it to avoid a FlutterError.

What category of rule is this? (place an "X" next to just one item)

  • Warns about a potential error (problem)
  • Suggests an alternate way of doing something (suggestion)
  • Other (please specify:)

Provide 2-3 code examples that this rule will warn about (it will be better if you can provide both good and bad examples):

❌ Bad:

FloatingActionButton(
  onPressed: () => context.read<CounterCubit>().increment(),
  child: const Icon(Icons.add),
), // LINT

✅ Good:

FloatingActionButton(
  heroTag: 'increment_heroTag',
  onPressed: () => context.read<CounterCubit>().increment(),
  child: const Icon(Icons.add),
),

Are you willing to submit a pull request to implement this rule?

No, too complex for me.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions