InstrumentedNotifier mixin

Generic mixin for any class that performs state mutations.

Call emitCause at every mutation site to record the state change in the TrinityEventBus and link it to the current causal context.

Zero overhead in release buildsemitCause is wrapped in assert().

Usage

class AuthService with InstrumentedNotifier {
  Future<void> login(String email) async {
    emitCause('login_started', metadata: {'email': email});
    final result = await _api.login(email);
    emitCause('login_completed', metadata: {'user_id': result.userId});
  }
}

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

emitCause(String description, {Map<String, dynamic>? metadata, CausalEventType type = CausalEventType.stateChange}) → void
Emit a causal event linked to the current CausalityZone context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited