MemoryTransport class
- Implemented types
Constructors
- MemoryTransport({required Conversation seed, Duration latency = const Duration(milliseconds: 120)})
Properties
-
events
→ Stream<
TransportEvent> -
Real-time event stream from the backend.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique identifier for this adapter (e.g. 'websocket', 'firestore').
no setteroverride
- latency → Duration
-
Simulated network latency (set to Duration.zero for instant tests).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- seed → Conversation
-
final
Methods
-
connect(
) → Future< void> -
Opens the connection and starts emitting TransportEvents.
override
-
deleteMessage(
String messageId) → Future< DeliveryStatus> -
Deletes
messageIdon the backend.override -
disconnect(
) → Future< void> -
Closes the connection cleanly.
override
-
editMessage(
String messageId, Message updated) → Future< DeliveryStatus> -
Updates
updatedon the backend.messageIdis the local/remote ID of the message to replace.override -
fetchConversation(
String id) → Future< Conversation> -
Loads the full Conversation snapshot at startup.
override
-
fetchHistory(
{required String conversationId, DateTime? before, int limit = 50}) → Future< List< Message> > -
Loads a page of history before
before(cursor-based pagination).override -
injectEvent(
TransportEvent event) → void - Injects any TransportEvent directly into the event stream. Useful for simulating arbitrary server-side events in tests.
-
markRead(
String conversationId, DateTime readAt) → Future< void> -
Marks the conversation as read for the current user at
readAt.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reactToMessage(
String messageId, String emoji) → Future< void> -
Toggles an emoji reaction on
messageId.override -
sendMessage(
Message m) → Future< DeliveryStatus> -
Sends
mto the backend and returns its DeliveryStatus.override -
sendTyping(
String conversationId, {bool isTyping = true}) → Future< void> -
Emits a "typing" indicator.
isTyping=false stops it.override -
simulateIncoming(
Message m) → void - Injects a fake incoming message from another user (useful for demos).
-
simulateTyping(
String conversationId, String userId, {bool isTyping = true}) → void -
Injects a fake typing indicator from
userId. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited