air_framework 1.0.0 copy "air_framework: ^1.0.0" to clipboard
air_framework: ^1.0.0 copied to clipboard

A modular, reactive, and scalable framework for Flutter. Build industrial-grade apps with a decoupled architecture.

Air Framework πŸš€ #

pub package License: MIT style: lint

A modular, reactive, and scalable framework for Flutter. Build industrial-grade apps with a decoupled architecture inspired by enterprise app concepts.

Why Air Framework?

As apps grow, they become harder to maintain. Air Framework solves this by enforcing strict module boundaries, unidirectional data flow, and explicit dependencies. It's not just a state management library; it's a complete architecture for teams building large-scale Flutter applications.


✨ Features #

Feature Description
🧩 Modular Architecture Self-contained, independent modules with clear boundaries
⚑ Reactive State Built-in state management using Air State controller with typed flows
πŸ’‰ Dependency Injection Type-safe DI with scoped services and lifecycle management
πŸ”’ Security Permission system, secure logging, and audit trails
πŸ›£οΈ Routing Integrated routing with go_router support
πŸ› οΈ DevTools Built-in debugging panels for state, modules, and performance

| πŸ§ͺ Testing Utilities | Mock controllers and test helpers included |


πŸ—οΈ Architecture #

Every feature is a Module. Modules declare their dependencies explicitly and communicate via a typed Event Bus.

graph TD
    App[App Shell] --> Notes[Notes Module]
    App --> Weather[Weather Module]
    App --> Dash[Dashboard Module]

    Dash -.->|Depends on| Notes
    Dash -.->|Depends on| Weather

    subgraph CoreF [Core Framework]
    Core[Air Core]
    DI[AirDI]
    Bus[EventBus]
    Router[AirRouter]
    State[AirState]
    CLI[AirCLI]
    end

    Notes --> CoreF
    Weather --> CoreF

πŸ“¦ Installation #

Add air_framework to your pubspec.yaml:

dependencies:
  air_framework: ^1.0.0

For the complete development experience, also install the CLI:

dart pub global activate air_cli

πŸš€ Quick Start #

1. Create a Module #

Define a module by extending AppModule. This encapsulates your routes, bindings, and initialization logic.

import 'package:air_framework/air_framework.dart';

class CounterModule extends AppModule {
  @override
  String get id => 'counter';

  @override
  List<AirRoute> get routes => [
    AirRoute(
      path: '/counter',
      builder: (context, state) => const CounterPage(),
    ),
  ];

  @override
  void onBind(AirDI di) {
    // Register dependencies lazily
    di.registerLazySingleton<CounterState>(() => CounterState());
  }
}

2. Define State #

Use the @GenerateState annotation to magically generate reactive Flows and Pulses.

Simply modify fields like a standard Dart class (e.g. count++), and the framework automatically detects the change and updates only the widgets listening to that value. No boilerplate, no notifyListeners()β€”just pure logic.

import 'package:air_framework/air_framework.dart';

part 'state.air.g.dart';

@GenerateState('counter')
class CounterState extends _CounterState {
  // Private fields become reactive StateFlows
  int _count = 0;

  // Public methods become dispatchable Pulses
  @override
  void increment() {
    count++;
  }
}

3. Build Reactive UI #

Use AirView to listen to state changes efficiently. It automatically tracks which flows are accessed and rebuilds only when necessary.

class CounterPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: AirView((context) {
          // Auto-subscribes to 'count'
          return Text('Count: ${CounterFlows.count.value}');
        }),
      ),
      floatingActionButton: FloatingActionButton(
        // Triggers the 'increment' pulse
        onPressed: () => CounterPulses.increment.pulse(null),
        child: const Icon(Icons.add),
      ),
    );
  }
}

4. Initialize Your App #

Register your modules in main.dart.

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // 1. Configure Air State
  configureAirState();

  // 2. Register Modules
  await ModuleManager().register(CounterModule());
  // await ModuleManager().register(AuthModule());

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      title: 'Air App',
      routerConfig: AirRouter().router,
    );
  }
}

πŸ”§ CLI Tools #

The Air CLI allows you to scaffold modules and generate state files instantly.

# Create a new project
air create my_app --template=starter

# Generate a new module
air generate module inventory

# Generate state code (run inside a module directory)
air generate state

Package Description
air_cli Command-line scaffolding tool
air_state Core reactive state package
air_generator Build runner code generation

🀝 Contributing #

Contributions are welcome! Please read our contributing guidelines first.

πŸ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.


Made by Andrey D. Araya

0
likes
160
points
48
downloads

Publisher

unverified uploader

Weekly Downloads

A modular, reactive, and scalable framework for Flutter. Build industrial-grade apps with a decoupled architecture.

Repository (GitHub)
View/report issues

Topics

#flutter #framework #state-management #modular #architecture

Documentation

API reference

License

MIT (license)

Dependencies

air_state, archive, cupertino_icons, flutter, go_router, path

More

Packages that depend on air_framework