owl_mediator 1.0.1 copy "owl_mediator: ^1.0.1" to clipboard
owl_mediator: ^1.0.1 copied to clipboard

An implementation of the architectural mediator pattern, with CQRS support.

A package that implements the architectural mediator pattern, with CQRS support.
(This package has nothing to do with owls, except that it was made by one).

Features #

  • CQRS (command/query request separation) support.

Getting started #

  • Install the package in your preferred way.
  • Implement some commands and queries.
  • Register them with the mediator.

Usage #

A simple example of how to use the mediator class.

void main() async {
  // Create a new mediator, this should only be needed once per your application.
  Mediator mediator = Mediator();

  // Register the query handler for its query type.
  // This will hopefully be code-generated later on.
  mediator.registerQuery(GetAsStringQueryHandler());

  // Create and run your query.
  String result1 = await mediator.runQuery(GetAsStringQuery(123));
  print(result1);

  // If you implemented the optional extension method, then you can do this instead.
  String result2 = await mediator.getAsString(123);
  print(result2);
}

Check out the other examples for more in-depth explanations.

Additional information #

This package is maintained over at github.com/owl-shed/dart_mediator, I probably won't accept code PRs but who knows, if you find an issue then let me know.

0
likes
0
points
15
downloads

Publisher

unverified uploader

Weekly Downloads

An implementation of the architectural mediator pattern, with CQRS support.

Repository (GitHub)
View/report issues

Topics

#architecture #clean-architecture #cross-platform #async #mediator

Funding

Consider supporting this project:

ko-fi.com
github.com

License

unknown (license)

More

Packages that depend on owl_mediator