Rust FFI API for Flutter integration.
Initialize the Toss core library.
dataDir : '/path/to/data' ,
Parameters:
dataDir: Path to data directory
deviceName: Friendly device name
Returns: void
Get the current device’s unique identifier.
String deviceId = api. getDeviceId ();
Returns: String - Device ID
Set the device’s friendly name.
api. setDeviceName (name : 'My Device' );
Parameters:
Returns: void
Start a pairing session.
PairingInfo info = await api. startPairing ();
Returns: PairingInfo with:
code: 6-digit pairing code
qrData: QR code data
expiresAt: Expiration timestamp
publicKey: Public key for pairing
Complete pairing using QR code.
bool success = await api. completePairingQr (
Parameters:
qrData: QR code data from other device
Returns: bool - Success status
Complete pairing using 6-digit code.
bool success = await api. completePairingCode (
Parameters:
code: 6-digit pairing code
Returns: bool - Success status
Get list of paired devices.
List < DeviceInfo > devices = await api. getPairedDevices ();
Returns: List<DeviceInfo> with:
id: Device ID
name: Device name
isOnline: Online status
lastSeen: Last seen timestamp
Send clipboard content to paired devices.
bool success = await api. sendClipboard (
contentType : 'text/plain' ,
content : 'Hello, World!' ,
Parameters:
contentType: MIME type of content
content: Base64-encoded content
Returns: bool - Success status
Get clipboard history.
List < ClipboardItemInfo > history = await api. getClipboardHistory (
Parameters:
limit: Maximum number of items
Returns: List<ClipboardItemInfo> with:
contentType: Content type
preview: Preview text
sizeBytes: Size in bytes
timestamp: Timestamp
sourceDevice: Source device ID
Poll for network events.
NetworkEvent ? event = await api. pollEvent ();
Returns: NetworkEvent? - Event or null if none
Get current settings.
TossSettings settings = await api. getSettings ();
Returns: TossSettings with:
autoSync: Auto-sync enabled
syncText: Sync text content
syncImages: Sync images
syncFiles: Sync files
maxFileSizeMb: Max file size in MB
historyEnabled: History enabled
historyDays: History retention days
relayUrl: Relay server URL
Update settings.
api. updateSettings (settings : settings);
Parameters:
settings: Updated settings object
Returns: void
All API functions may throw exceptions. Handle errors appropriately:
await api. startPairing ();