DISCOOS, the community-driven initiative to create open-source software for search and rescue and disaster relief communications, has created an EventStoreDB client for Dart. It is a high-quality and community-developed package that brings EventStoreDB to Dart and Flutter developers.
The DISCOOS community is working hard to make the client fully compliant with all the EventStoreDB gRPC Client APIs. Make sure to Star and Watch the GitHub repository for further updates.
As of version 0.2.1 all core features are supported, which include
All of the administration APIs for users, access control, operations, and monitoring are still in progress. You can follow the progress and roadmap on Github.
The code has been structured and classes named to be in line with the official Dotnet client in C#. As Dart has excellent support for async/await and streams, where appropriate there are code patterns native to Dart when C# doesn't yield effective Dart code.
This is how you get started with EventStore Client in Dart:
eventstore_client: ^0.2.1
to pubspec.yamlimport 'package:eventstore_client/eventstore_client.dart';
void main() async {
// Create a client instance
final client = EventStoreStreamsClient(
EventStoreClientSettings.parse(
'',
),
);
// Fetch all events in EventStore
final result = await client.readFromAll(
forward: true,
resolveLinks: true,
position: LogPosition.start,
);
// Only print if read was successful
if (result.isOK) {
await for (var event in result.stream) {
print(event);
}
}
}
Now you can event source effectively in Dart! There will be more updates in the future, so keep checking back for further updates.
This post has been edited and rewritten from a version that appeared on Medium with the author's permission.