flutter_ftp_dtp library

Flutter FTP & DTP — LAN file sharing and realtime sync for Flutter apps.

FTP (File Transfer Pattern) — one-shot JSON export/import over HTTP. DTP (Data Transfer Pattern) — live bidirectional sync over WebSocket.

Classes

DeviceId
Stable per-install device id for echo suppression and last-write-wins.
FileImportDialog
FileShareDialog
ImportSummary
Result of an import, for confirmation UI.
LocalFileShareService
Exports/imports JSON data between devices over the local Wi-Fi network.
RealtimeSyncDialog
RealtimeSyncEngine
DTP (Data Transfer Pattern) — realtime LAN sync over WebSocket.
ShareHttpServer
Web / unsupported-platform stub for ShareHttpServer.
ShareSession
A live sharing session on the host device.
ShareTarget
Connection details parsed from a scanned QR code or entered manually.
SyncAdapter
Callbacks that wire the sync engine to your app's storage layer.
SyncClientHandle
SyncHostInfo
Host connection info shown to the user (QR/manual pairing).
SyncMessage
One envelope on the wire.
SyncType
Message types exchanged over the live-sync WebSocket.
SyncWsServer

Constants

kShareSchemaVersion → const int
Payload version. Bump if the export shape changes incompatibly.

Functions

generateShareToken() String
Generates a 6-character uppercase alphanumeric token (no ambiguous chars).
resolveLocalIp() Future<String?>
showFileImportDialog(BuildContext context, {required LocalFileShareService service, String title = 'Import Data', String blockedMessage = 'Cannot import while there are active items. Clear them first.'}) Future<ImportSummary?>
Shows the file-import (FTP) dialog. Returns ImportSummary on success.
showFileShareDialog(BuildContext context, {required LocalFileShareService service, String title = 'Share Data', String description = 'Scan this QR from the other device. Both devices must be on the same Wi-Fi network.'}) Future<void>
Shows the file-share (FTP) host dialog: starts a LAN HTTP server and displays a QR code + connection details for receivers.
showRealtimeSyncDialog(BuildContext context, {required RealtimeSyncEngine engine, String title = 'Live Sync', String description = 'Keep data in sync across devices on the same Wi-Fi. One device hosts; others join.'}) Future<void>
Opens the live-sync (DTP) dialog — host or join.

Exceptions / Errors

ShareException