โšก 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

https://zeba.academy/flutter/


๐Ÿ“œ 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.