Skip to content
pubscout

stacked_hooks

0.2.4, released 3 years ago by filledstacks.com

Classes that help use Flutter Hooks with the stacked package architecture.

WASM-ready
$ flutter pub add stacked_hooks
Source repository

What it does

It provides widget classes like StackedHookView that bridge the stacked architecture with the flutter_hooks package. This allows you to consume ViewModels provided by Provider while utilizing hooks inside your widget build methods.

AI-written summary of version 0.2.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are building an app using the stacked architecture and want to use flutter_hooks
  • You need to manage local UI controllers like TextEditingController within stacked views

Skip it when

  • You are not using the stacked architecture package
  • you prefer other state management solutions like Riverpod or Bloc

Strengths

  • Integrates flutter_hooks seamlessly with stacked ViewModels
  • Reduces boilerplate when using TextEditingControllers and similar hooks in stacked views

Weaknesses

  • Dependent on both stacked and flutter_hooks ecosystems
  • Limited functionality beyond bridging the two packages

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2

not documented

class _HookForm extends StackedHookView<HomeViewModel> {
  @override
  Widget buildStackedView(BuildContext context, HomeViewModel model) {
    final title = useTextEditingController();
    return Column(
      mainAxisSize: MainAxisSize.min,
      children: <Widget>[
        Text(model.title),
        TextField(controller: title, onChanged: model.updateTitle),
      ],
    );
  }
}

Works with

Packages commonly used together with stacked_hooks: ones it builds on, ones built on it, and its own family.