messageport_tizen 0.3.2 copy "messageport_tizen: ^0.3.2" to clipboard
messageport_tizen: ^0.3.2 copied to clipboard

A Flutter plugin that allows communication between multiple applications on Tizen using Tizen Message Port.

messageport_tizen #

pub package

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';

Create local port #

Use LocalPort.create() method to create a local port.

String portName = 'servicePort';
LocalPort localPort = await LocalPort.create(portName);

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);

Use LocalPort.unregister() to unregister port when it is no longer needed.

localPort.unregister();

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);

Send message #

To send message to remote applcation, use RemotePort.send() method.

final message = {'a': 1, 'b': 2, 'c': 3};
await remotePort.send(message);

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);

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.

0
likes
120
pub points
26%
popularity

Publisher

verified publishertizen.org

A Flutter plugin that allows communication between multiple applications on Tizen using Tizen Message Port.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on messageport_tizen