cqrs library
A library for convenient communication with CQRS-compatible backends, using queries and commands.
Example:
final apiUri = Uri.parse('https://flowers.garden/api/');
final cqrs = Cqrs(
loginClient,
apiUri,
);
// Fetching first page of flowers
final flowers = await cqrs.get(AllFlowers()..page = 1);
// Adding a new flower
final result = await cqrs.run(AddFlower()
..name = 'Daisy'
..pretty = true);
print(result.success); // true
See also:
- https://github.com/leancodepl/corelibrary
- https://www.nuget.org/packages/LeanCode.ContractsGenerator/ - code generation tool for easy contracts transpilation from C# to Dart and TypeScript.
Classes
- Command
- Command carrying data related to performing a certain action on the backend.
- CommandResult
- The result of running a Command.
- Cqrs
- Class used for communicating with the backend via queries and commands.
- CqrsMethod
- Base class for contracts that can be serialized and sent to the backend.
-
Operation<
T> - Operation describing a criteria for a query, a command, and the results it returns.
-
Query<
T> - Query describing a criteria for a query and the results it returns.
- ValidationError
- A validation error.
Exceptions / Errors
- CqrsException
- Usually thrown by Cqrs.get or Cqrs.run.