Skip to content

feat: add opt-in prefer_widget_class lint rule - #136

Merged
riscait merged 2 commits into
mainfrom
codex/prefer-widget-class
Sep 30, 2026
Merged

riscait merged 2 commits into
mainfrom
codex/prefer-widget-class

Conversation

@riscait

@riscait riscait commented Sep 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Add prefer_widget_class for functions, methods, and getters returning Flutter widgets, while excluding framework build methods.
  • Keep the rule disabled by default and document how consumers can enable it in analysis_options.yaml.
  • Cover explicit and inferred return types, nullable and derived widgets, and consumer-side opt-in configuration.

Verification

  • dart test packages/altive_lints_plugin (93 tests passed)
  • dart analyze
  • flutter analyze
  • dart run tool/verify_v4_split.dart

Release note

Package versions and pub.dev publication are deferred. Before publishing the preset, raise its minimum plugin version to the release containing this rule and publish the plugin first.

Closes #122

@riscait
riscait requested a review from a team as a code owner September 30, 2026 13:25
@riscait
riscait requested review from k-nkmr and removed request for a team September 30, 2026 13:25
@riscait
riscait force-pushed the codex/prefer-widget-class branch from da8077f to 26dfb10 Compare September 30, 2026 14:01
@riscait
riscait merged commit fca2427 into main Sep 30, 2026
1 check passed
@riscait
riscait deleted the codex/prefer-widget-class branch September 30, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[LintRule] Warn on methods returning Widgets; prefer class-based Widgets

1 participant