zeba_academy_state_tools 1.0.0
zeba_academy_state_tools: ^1.0.0 copied to clipboard
Lightweight reactive state management toolkit for Flutter with async state widgets, reactive controllers, lifecycle-aware state handling and minimal boilerplate.
โก zeba_academy_state_tools #
A lightweight reactive state management toolkit for Flutter with async state widgets, reactive controllers, lifecycle-aware state handling, and minimal boilerplate.
Built for production Flutter apps that need clean, scalable state handling without heavy frameworks.
โจ Features #
- Reactive Controllers
- Async State Widgets (Loading / Success / Error)
- Lifecycle-aware State Handling
- Minimal Boilerplate Architecture
- Highly Performant Reactive Updates
- Simple and Easy to Integrate
- Clean Flutter UI Support
- Production Ready
๐ธ Screenshots #
Reactive Controller with Async State Widget #
[Reactive Controller Demo]
Make sure your screenshot exists in:
zeba_academy_state_tools/
โโ screenshots/
โโ demo.png
And declared in pubspec.yaml:
screenshots:
- description: Reactive controller with async state widget
path: screenshots/demo.png
๐ฆ Installation #
Add the package to your Flutter project:
dependencies:
zeba_academy_state_tools: ^1.0.0
Then run:
flutter pub get
๐ Quick Example #
import 'package:flutter/material.dart';
import 'package:zeba_academy_state_tools/zeba_academy_state_tools.dart';
void main() {
runApp(const ExampleApp());
}
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: CounterPage(),
debugShowCheckedModeBanner: false,
);
}
}
class CounterController extends ReactiveController<int> {
CounterController() : super(0);
void increment() {
update(state + 1);
}
}
class CounterPage extends StatefulWidget {
const CounterPage({super.key});
@override
State<CounterPage> createState() => _CounterPageState();
}
class _CounterPageState extends LifecycleState<CounterPage> {
final controller = CounterController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("State Tools Example")),
body: Center(
child: ReactiveBuilder<int>(
controller: controller,
builder: (context, value) {
return Text(
"Counter: $value",
style: const TextStyle(fontSize: 32),
);
},
),
),
floatingActionButton: FloatingActionButton(
onPressed: controller.increment,
child: const Icon(Icons.add),
),
);
}
}
๐ง Async State Widget Example #
AsyncStateWidget<String>(
future: loadData(),
loading: () => const CircularProgressIndicator(),
error: (err) => Text("Error: $err"),
success: (data) => Text(data),
)
โ๏ธ Core Components #
ReactiveController #
A lightweight reactive state holder.
final controller = ReactiveController<int>(0);
controller.update(10);
ReactiveBuilder #
Automatically rebuilds UI when state changes.
ReactiveBuilder<int>(
controller: controller,
builder: (_, value) {
return Text("$value");
},
)
AsyncStateWidget #
Handles loading, success, and error UI automatically.
AsyncStateWidget<List<String>>(
future: fetchUsers(),
loading: () => const CircularProgressIndicator(),
error: (e) => Text(e.toString()),
success: (users) => Text(users.length.toString()),
)
LifecycleState #
Lifecycle-aware state handling.
class MyPageState extends LifecycleState<MyPage> {
@override
void onInit() {
super.onInit();
}
@override
void onDispose() {
super.onDispose();
}
}
๐ Package Structure #
lib/
โโ zeba_academy_state_tools.dart
โโ src/
โโ reactive_controller.dart
โโ reactive_builder.dart
โโ async_state_widget.dart
โโ lifecycle_state.dart
๐ฏ Why Use zeba_academy_state_tools? #
| Feature | Benefit |
|---|---|
| Reactive Controllers | Automatic UI updates |
| Async State Widgets | Simplified async UI |
| Lifecycle Handling | Clean resource management |
| Minimal Boilerplate | Faster development |
| Lightweight | Very small package size |
๐งช Testing #
Run tests with:
flutter test
This package includes a comprehensive test suite to ensure reliability.
๐ Use Cases #
Perfect for:
- EdTech apps
- Dashboards
- Realtime UI updates
- Small to medium Flutter apps
- Clean architecture projects
๐ Homepage #
๐ License #
This project is licensed under the GPL License.
See the LICENSE file for details.
๐จโ๐ป Maintained by #
Zeba Academy
Building professional Flutter tools for modern apps.
