init
1.0.0, released a year ago by bam.tech
A Flutter widget to execute initialization and disposal logic declaratively.
WASM-ready
What it does
The package provides an Init widget that allows you to specify initialization, post-frame, dependency change, and disposal logic as parameters. This helps reduce boilerplate code usually found in StatefulWidget lifecycles like initState and dispose.
AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to trigger initialization or disposal logic without creating a full StatefulWidget.
- You want to encapsulate initialization patterns in a reusable way across your widget tree.
Skip it when
- You already manage your state and side effects inside a complex state management solution.
- You require fine-grained imperative control over custom state objects.
Strengths
- Reduces boilerplate of creating StatefulWidgets just for lifecycle methods.
- Makes initialization and disposal logic declarative and modular.
Weaknesses
- Limited to basic widget lifecycle hooks provided by the Init wrapper.
- Not documented for complex state management needs.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
not documented
Init(
onInit: () => print('Initializing...'),
onDispose: () => print('Cleaning up...'),
child: const Text('Hello!'),
)