neurostate 0.1.3 copy "neurostate: ^0.1.3" to clipboard
neurostate: ^0.1.3 copied to clipboard

Intelligent, AI-augmented predictive state management for modern Flutter applications.

๐Ÿง  NeuroState #

Pub Version | License: MIT

Intelligent, AI-augmented predictive state management for modern Flutter applications.

NeuroState introduces an intelligence layer on top of traditional reactive state management.

Instead of only reacting to user events, NeuroState can predict and adapt state transitions based on:

  • User behavior
  • Application context
  • Rule engines
  • External APIs
  • AI/LLM models

โœจ Why NeuroState? #

Traditional state management reacts.

NeuroState predicts.

User Event โ†’ NeuroPredictor โ†’ Smart State Update โ†’ UI Rebuild

This makes it ideal for:

  • AI chat apps
  • Smart recommendations
  • Predictive UX
  • Context-aware workflows
  • Intelligent dashboards

โœจ Features #

  • ๐Ÿง  AI-augmented predictive state updates
  • โšก Reactive ChangeNotifier-based architecture
  • ๐Ÿ”Œ Pluggable predictor system (Rules / API / ML / LLM)
  • ๐Ÿงฉ Strongly typed generic state support
  • ๐Ÿ›ก Built-in loading & error handling
  • ๐Ÿ”„ Works alongside existing state management solutions
  • ๐Ÿ“ฆ Lightweight & flexible

๐Ÿ“ฆ Installation #

Add to your pubspec.yaml:

dependencies:
  neurostate: ^0.1.0

Then run:

flutter pub get

๐Ÿš€ Quick Start (Typed Version) #

1๏ธโƒฃ Import Package #

import 'package:neurostate/neurostate.dart';

2๏ธโƒฃ Create a Strongly-Typed State Model #

class ChatState {
  final bool typing;
  final bool showRecommendations;

  const ChatState({
    this.typing = false,
    this.showRecommendations = false,
  });

  ChatState copyWith({
    bool? typing,
    bool? showRecommendations,
  }) {
    return ChatState(
      typing: typing ?? this.typing,
      showRecommendations:
          showRecommendations ?? this.showRecommendations,
    );
  }
}

3๏ธโƒฃ Create a Predictor #

class ChatPredictor implements NeuroPredictor<ChatState> {
  ChatState _current = const ChatState();

  @override
  Future<ChatState> predict(
    String event,
    Map<String, dynamic> payload,
  ) async {
    await Future.delayed(const Duration(milliseconds: 300));

    switch (event) {
      case "send_message":
        _current = _current.copyWith(typing: true);
        break;

      case "open_cart":
        _current =
            _current.copyWith(showRecommendations: true);
        break;
    }

    return _current;
  }
}

4๏ธโƒฃ Initialize Controller #

final controller = NeuroController<ChatState>(
  predictor: ChatPredictor(),
  initialState: const ChatState(),
);

5๏ธโƒฃ Dispatch Events #

controller.dispatch("send_message", {
  "text": "Hello"
});

6๏ธโƒฃ Listen to State in UI #

AnimatedBuilder(
  animation: controller,
  builder: (_, __) {
    final state = controller.state;

    if (controller.isLoading) {
      return const CircularProgressIndicator();
    }

    return Column(
      children: [
        if (state.typing)
          const Text("AI is typing..."),

        if (state.showRecommendations)
          const Text("Showing recommendations"),
      ],
    );
  },
);

๐Ÿง  Advanced Capabilities #

Preview State (Without Committing) #

final predicted = await controller.preview(
  "open_cart",
  {},
);

Useful for:

  • Preloading screens
  • Predictive navigation
  • UI hints before committing

๐Ÿงช Example Use Cases #

  • ๐Ÿค– AI Chat Applications
  • ๐Ÿ› Smart Recommendation Dashboards
  • ๐Ÿ“Š Predictive Analytics Panels
  • ๐Ÿงพ Context-aware Form Validation
  • โšก Adaptive UX Personalization
  • ๐Ÿš€ Predictive Data Preloading

๐Ÿ—๏ธ Architecture Overview #

NeuroState separates intelligence from UI logic.

UI Layer
   โ†“
NeuroController<T>
   โ†“
NeuroPredictor<T>
   โ†“
Typed State Model

This keeps your:

  • UI clean
  • Business logic modular
  • AI integration replaceable
  • Architecture scalable

๐Ÿ”ฎ Roadmap #

  • ๐Ÿค– OpenAI / LLM predictor integration
  • ๐Ÿ” Riverpod & Bloc adapters
  • ๐ŸŒ WebSocket streaming support
  • ๐Ÿ“ฑ On-device ML model support
  • ๐Ÿง  Intelligent caching engine
  • ๐Ÿ“ฆ DevTools integration

๐Ÿ†š Why Not Just Provider or Bloc? #

NeuroState does not replace them.

It adds intelligence on top.

You can combine NeuroState with:

  • Provider
  • Bloc
  • Riverpod
  • Vanilla ChangeNotifier

NeuroState focuses on predictive logic, not dependency injection or routing.


๐Ÿ“„ License #

MIT License.


๐Ÿค Contributing #

Contributions, issues, and feature requests are welcome!

If youโ€™d like to improve:

  • Predictors
  • Integrations
  • Performance
  • Documentation

Feel free to open a pull request or create an issue.


๐ŸŒŸ Vision #

NeuroState aims to become the foundation for:

AI-native Flutter applications.

0
likes
160
points
319
downloads

Publisher

unverified uploader

Weekly Downloads

Intelligent, AI-augmented predictive state management for modern Flutter applications.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on neurostate