MessageClient class
Client for receiving untyped messages from palettes.
Example:
final messageClient = MessageClient();
// Listen for all messages
messageClient.onMessage((msg) {
print('Got message: ${msg.type} from ${msg.paletteId}');
});
// Listen for specific message type
messageClient.on('my-event', (msg) {
print('Received: ${msg.data}');
});
- Inheritance
-
- Object
- ServiceClient
- MessageClient
Constructors
- MessageClient(NativeBridge bridge)
Properties
- bridge → NativeBridge
-
Protected access to bridge for subclasses that need direct bridge access.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serviceName → String
-
The service name (must match native side).
no setteroverride
Methods
-
dispose(
) → void -
Clean up all subscriptions.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
off(
String type, void callback(PaletteMessage)) → void - Remove a callback.
-
on(
String type, void callback(PaletteMessage)) → void - Listen for a specific message type.
-
onEvent(
String eventName, void callback(NativeEvent)) → void -
Subscribe to events from this service.
inherited
-
onMessage(
void callback(PaletteMessage)) → void - Listen for all messages from palettes.
-
onWindowEvent(
String windowId, String eventName, void callback(NativeEvent)) → void -
Subscribe to events for a specific window.
inherited
-
send<
T> (String command, {String? windowId, Map< String, dynamic> ? params}) → Future<T?> -
Send a command to this service.
inherited
-
sendFireAndForget(
String command, {String? windowId, Map< String, dynamic> ? params}) → void -
Send a command, fire and forget.
inherited
-
sendForMap(
String command, {String? windowId, Map< String, dynamic> ? params}) → Future<Map< String, dynamic> ?> -
Send a command expecting a Map result.
inherited
-
sendToPalette(
String paletteId, String type, [Map< String, dynamic> ? data]) → Future<void> - Send a message to a palette (Host → Palette).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited