state_extended
7.6.0, released a year ago by andrioussolutions.com
Extends Flutter's State class with controllers, lifecycle events, and async support.
WASM-ready
What it does
Extends Flutter's State class to separate business logic and mutable properties into a StateXController. It includes built-in FutureBuilder and InheritedWidget capabilities, along with numerous lifecycle event handlers.
AI-written summary of version 7.6.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to separate business logic from your State objects using controllers.
- You need access to a comprehensive set of lifecycle events inside state or controller classes.
- You require built-in FutureBuilder functionality for asynchronous initialization within your State objects.
Skip it when
- You prefer modern reactive state management libraries like Bloc, Provider, or Riverpod.
- You want a framework built around GetX.
- You need a lightweight alternative without extra wrapper classes for standard State management.
Strengths
- Separates business logic cleanly from the UI and State objects.
- Provides over 20 lifecycle event handlers for State and Controller.
- Built-in asynchronous initialization support via initAsync().
Weaknesses
- Not compatible with GetX architecture despite similar controller naming.
- Custom state management approach that deviates from standard Flutter paradigms.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
class MyHomePage extends StatefulWidget {
@override
StateX createState() => MyHomePageState();
}
class MyHomePageState extends StateX {
MyHomePageState() : super(controller: MyHomePageController()) {
// Controller is available via controller
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('StateX Example')),
body: Center(child: Text('Hello StateX')),
);
}
}
class MyHomePageController extends StateXController {
// Business logic here
}Alternatives
Packages that do the same job and could replace state_extended.
Works with
Packages commonly used together with state_extended: ones it builds on, ones built on it, and its own family.