type property
dynamic
get
type
A semantic identifier representing the category or intent of the pulse.
When to use
- Use this to tag pulses by type — 'user_login', 'system_heartbeat', 'data_update'. It's useful for routing and filtering in hubs and valves.
- Routing pulses to specific handlers in a hub.
- Filtering pulses in a valve.
- Categorising signals for monitoring.
- Pattern matching in custom receptors.
How it works
The type is resolved by walking up the parent chain if not overridden.
It's a semantic tag that travels with the pulse. The value is dynamic:
most pulses use a String tag, but richer classifiers (for example an
enum such as a domain event type) are also supported.
Example
final pulse = Pulse.governed<String>(
payload: 'New Email',
type: 'action:update_email',
);
// In a Receptor
if (pulse.type == 'action:update_email') {
// Handle email update
}
Example: non‑String classifier
enum MailAction { update, archive }
final pulse = Pulse<String>('New Email', type: MailAction.update);
if (pulse.type == MailAction.update) {
// Handle email update
}
Implementation
dynamic get type;