AmiMessage class

Immutable base class for all AMI messages.

Represents a message in the Asterisk Manager Interface protocol. All AMI messages contain headers and have a specific type.

Implementers
Annotations
  • @immutable

Constructors

AmiMessage({required String id, required MessageType type, required Map<String, String> headers, required DateTime timestamp})
Creates an immutable AMI message.
const
AmiMessage.fromHeaders(Map<String, String> headers)
Creates an AMI message from a map of headers.
factory

Properties

hashCode int
The hash code for this object.
no setteroverride
headers Map<String, String>
Message headers as key-value pairs.
final
id String
Unique identifier for this message (usually ActionID or auto-generated).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timestamp DateTime
When this message was created/received.
final
type MessageType
Type of message (response, event, action, greeting, unknown).
final

Methods

containsKey(String key) bool
Checks if a header exists.
copyWith({String? id, MessageType? type, Map<String, String>? headers, DateTime? timestamp}) AmiMessage
Creates a copy of this message with updated values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override
operator [](String key) String?
Gets a header value by key.