Skip to content
pubscout

alfreed

0.4.1, released 4 years ago by apparence.io

Splits business logic from views and manages page/animation state in Flutter.

WASM-ready
$ flutter pub add alfreed
Source repository

What it does

Forces a separation between business logic (presenters), view interfaces, and UI pages. It manages page states, animation controllers, and responsive layouts based on device size categories.

AI-written summary of version 0.4.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to enforce a strict separation between business logic and UI views.
  • You need built-in support for page animation controllers and responsive device sizing.

Skip it when

  • You are already using a comprehensive reactive state management solution like BLoC, Riverpod, or Provider and do not need an extra architecture wrapper.

Strengths

  • Clean separation of business logic via presenters and view interfaces.
  • Built-in handling of animation controllers and multi-animations.
  • Responsive device sizing context based on standard breakpoint ranges.

Weaknesses

  • Requires adopting a specific architectural pattern and class structure.
  • Not a reactive state management library on its own.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
class SecondPage extends AlfreedPage<MyPresenter, MyModel, ViewInterface> {
  SecondPage({Object? args}) : super(args: args);

  @override
  AlfreedPageBuilder<MyPresenter, MyModel, ViewInterface> build() {
    return AlfreedPageBuilder(
      key: ValueKey("presenter"),
      builder: (ctx, presenter, model) {
        return Scaffold(
          appBar: AppBar(title: Text(model.title ?? "")),
        );
      },
      presenterBuilder: (context) => MyPresenter(),
      interfaceBuilder: (context) => ViewInterface(context),
    );
  }
}

Alternatives

Packages that do the same job and could replace alfreed.

  • yx_state

    A state management library for Dart and Flutter applications.

  • bloc

    A Dart library for implementing the BLoC pattern with Cubits and Blocs.

  • flutter_bloc

    Flutter widgets to easily integrate blocs and cubits for state management.

  • cached_query

    Library for caching, background fetching, and managing server state in Dart and Flutter.