avoid_unnecessary_hook_widgets
v0.1.0 Warning Fix Widget Best Practices
This rule detects HookWidget subclasses whose build method does not call any hooks (useState, useMemoized, useEffect, etc.). If no hooks are used, the widget should be a plain StatelessWidget instead.
Why use this rule
Section titled “Why use this rule”HookWidget adds a hook management layer on top of the standard widget lifecycle. If you never call any hooks, that layer is pure overhead. Switching to StatelessWidget removes the dependency on flutter_hooks, makes the widget simpler, and signals to readers that no hook-based state management is happening.
See also: flutter_hooks
// HookWidget that never calls any hooksclass Greeting extends HookWidget { @override Widget build(BuildContext context) { return Text('Hello'); }}// StatelessWidget since no hooks are neededclass Greeting extends StatelessWidget { @override Widget build(BuildContext context) { return Text('Hello'); }}Configuration
Section titled “Configuration”To disable this rule:
plugins: many_lints: diagnostics: avoid_unnecessary_hook_widgets: false