Last updated:
0 purchases
messageport tizen
messageport_tizen #
This plugin adds support for communication between Flutter applications on Tizen platform.
Usage #
First, import the package in Dart file.
import 'package:messageport_tizen/messageport_tizen.dart';
copied to clipboard
Create local port #
Use LocalPort.create() method to create a local port.
String portName = 'servicePort';
LocalPort localPort = await LocalPort.create(portName);
copied to clipboard
To register callback to be called when message arrives to the local port, use LocalPort.register() method.
void onMessage(Object message, [RemotePort remotePort]) {
// Handle the received message.
}
...
localPort.register(onMessage);
copied to clipboard
Use LocalPort.unregister() to unregister port when it is no longer needed.
localPort.unregister();
copied to clipboard
Connect to remote port #
To connect to already registered port in remote application, use RemotePort.connect() method.
String portName = 'servicePort';
String remoteAppId = 'remote.app.id';
RemotePort remotePort = await RemotePort.connect(remoteAppId, portName);
copied to clipboard
Send message #
To send message to remote applcation, use RemotePort.send() method.
final message = {'a': 1, 'b': 2, 'c': 3};
await remotePort.send(message);
copied to clipboard
Send message with local port #
To send message with local port information, use RemotePort.send() method. Local port received by remote application can be used to send a response.
final message = 'This is a string message';
await remotePort.sendWithLocalPort(message, localPort);
copied to clipboard
Supported data types #
This plugin uses Flutter's StandardMessageCodec to encode transferred data into binary. The data can contain any value or collection type supported by Flutter's standard method codec.
null
bool
int, double
String
Uint8List, Int32List, Int64List, Float64List
Lists and Maps of the above
To learn more about the Tizen Message Port API, visit Tizen Docs: Message Port.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.