Skip to content
pubscout

acyclic_steps

0.11.2, released 2 years ago by google.dev

An explicit acyclic step dependency framework with concurrent evaluation and dependency injection.

WASM-readyQuiet but busy
$ flutter pub add acyclic_steps
Source repository

What it does

Defines steps with acyclic dependencies on other steps, evaluating them concurrently and caching results in a Runner object. It allows overriding steps to inject values or mocks for testing.

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

Use it when

  • You need to initialize complex projects or servers with multiple interdependent components.
  • You want to evaluate complex task graphs where tasks depend on previous results.
  • You need to easily override dependencies or mock values during testing.

Skip it when

  • You are looking for a standard widget tree state management solution.
  • You need a general-purpose service locator without task graph evaluation.

Strengths

  • Compile-time error for cyclic dependencies.
  • Concurrent evaluation of steps based on dependency constraints.
  • Built-in support for overriding steps with mock values during testing.

Weaknesses

  • Niche framework with relatively low adoption compared to standard DI packages.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
final Step<String> messageStep = Step.define('message').build(
  () => throw UnimplementedError('message must be overriden with input'),
);

final dateTimeStep = Step.define('date-time').build(
  () => DateTime.now().toString(),
);

final Step<void> printStep = Step.define('print')
    .dep(messageStep)
    .dep(dateTimeStep)
    .build((msg, time) async {
  await Future.delayed(Duration(milliseconds: 100));
  print('$msg at $time');
});

Alternatives

Packages that do the same job and could replace acyclic_steps.

  • get_it

    More widely used service locator for Flutter and Dart dependency injection.

  • injectable

    Code-generation based dependency injection built on top of get_it.