dart-ode

dart-ode is the Dart runtime for the ODE vocabulary.

It is intended for Flutter and Dart applications that want explicit direct, chain, sequence and guard-oriented flows.

Narrative Readability

ODE is designed so code can be read as narrative. A developer should be able to identify guard, execute, chain, sequence, dispatch and publish steps even in a language they do not use every day.

This does not mean every runtime has identical syntax. It means the conceptual reading path remains stable enough that a Java developer can follow a Go or Ruby flow, and a Swift developer can follow a TypeScript or Python flow, without relearning the product story from scratch.

What ODE Does Not Claim

ODE does not promise identical syntax across languages, and it does not remove the need to understand native platform idioms. It also does not require every runtime to expose the same UI layer.

The reason is pragmatic: forcing textual symmetry across Kotlin, Swift, Go, Ruby, PHP, TypeScript or Python would usually make the libraries feel unnatural inside their host ecosystems. ODE prefers semantic stability over artificial syntactic cloning.

Repository

Coordinates

  • package: dart_ode
  • version: 0.1.0

Public API

  • UseCase<P, R>
  • ChainUseCase<P, I, R>
  • SequenceUseCase<P, R>
  • UseCaseDispatcher
  • ValueOutput<T>, ErrorOutput<T>, EmptyOutput<T>, Outputs
  • GuardRejectedError

Core Concepts

1. UseCase

UseCase<P, R> keeps guard, execution and typed output delivery explicit.

2. ChainUseCase

ChainUseCase<P, I, R> is intended for two-step dependent flows.

3. SequenceUseCase

SequenceUseCase<P, R> preserves order across three or more entries.

4. UseCaseDispatcher

UseCaseDispatcher triggers a use case and can publish the resulting output to a callback.

Basic Examples

Direct UseCase

final useCase = UseCase<String, String>(
  execute: (param) => 'spotlight:$param',
);

Guarded UseCase

final guarded = UseCase<List<String>, String>(
  guard: (param) {
    if (param.first == param.last) {
      throw GuardRejectedError('comparison requires distinct entries');
    }
  },
  execute: (param) => '${param.first} vs ${param.last}',
);

Publish While Dispatching

final dispatcher = UseCaseDispatcher();
final output = dispatcher.dispatch<String, String>(
  'pikachu',
  useCase,
  publish: (result) => print(result),
);

Validation

dart test

Additional Guides

Libraries

dart_ode