zef_ddd_core 0.0.1 copy "zef_ddd_core: ^0.0.1" to clipboard
zef_ddd_core: ^0.0.1 copied to clipboard

A comprehensive Dart library designed to facilitate the implementation of Domain-Driven Design (DDD) principles in your applications

example/zef_ddd_core_example.dart

import 'package:zef_ddd_core/zef_ddd_core.dart';

import 'example_classes/user_id.dart';
import 'example_classes/user_registered_event.dart';
import 'example_classes/user_registration_welcome_email_handler.dart';

void main() {
  // Create and register the listener with the dispatcher
  var welcomeEmailHandler = UserRegistrationWelcomeEmailHandler();
  DomainEventDispatcher.instance
      .registerListener<UserRegisteredEvent>(welcomeEmailHandler);

  // Simulate user registration and creation of a UserRegisteredEvent
  var userId = UserId('456');
  var userRegisteredEvent = UserRegisteredEvent(userId, 'john.doe@example.com');

  // Dispatch the event
  DomainEventDispatcher.instance.dispatch(userRegisteredEvent).then((_) {
    print('User registration event dispatched successfully.');
  });
}
1
likes
160
pub points
50%
popularity

Publisher

verified publisherzooper.dev

A comprehensive Dart library designed to facilitate the implementation of Domain-Driven Design (DDD) principles in your applications

Homepage
Repository (GitHub)
View/report issues

Topics

#ddd #domain-driven-design #clean-architecture #domain-events #eventing

Documentation

API reference

Funding

Consider supporting this project:

buymeacoffee.com

License

MIT (LICENSE)

More

Packages that depend on zef_ddd_core