Flutter FTP & DTP

General-purpose LAN-based File Transfer Pattern and Data Transfer Pattern for Flutter apps.

FTP File Transfer Pattern

One-shot JSON export/import over HTTP. A host device starts a temporary LAN server; receivers download via QR scan or manual IP + token entry.

1
Host builds JSON export
2
HTTP server starts (port 8080–8120)
3
QR code displayed
4
Client GET /data.json?token=XXXX
5
Import into local storage
GET http://192.168.1.25:8080/data.json?token=A9X8M2

DTP Data Transfer Pattern

Realtime bidirectional sync over WebSocket. Every device keeps a full local copy. The host relays changes between clients with last-write-wins conflict resolution.

1
Host starts WebSocket server
2
Clients connect via QR
3
Snapshot sent to new clients
4
Deltas broadcast on change
5
Echo suppression + LWW
ws://192.168.1.25:8080/sync?token=A9X8M2

{"t":"entity_upsert","o":"dev_abc","id":"note_1","ts":1720000000,"d":{...}}

Platform Support

PlatformFTP HostFTP ClientDTP HostDTP Client
Android
iOS
macOS
Windows
Linux
Web

Package Structure

Flutter_FTP-DTP/
├── lib/
│   ├── flutter_ftp_dtp.dart      # Main export
│   └── src/
│       ├── ftp/                  # File Transfer Pattern
│       ├── dtp/                  # Data Transfer Pattern
│       ├── common/               # Shared utilities
│       └── ui/                   # Optional dialogs
├── example/                      # Demo app (all platforms)
├── doc/
│   └── index.html                # This page
├── README.md
├── INSTALLATION.md
└── CHANGELOG.md

Quick Integration

// pubspec.yaml
dependencies:
  flutter_ftp_dtp: ^1.0.3

// Dart
import 'package:flutter_ftp_dtp/flutter_ftp_dtp.dart';

final share = LocalFileShareService(
  buildExport: () => myData.toJson(),
  importExport: (j) async => myData.import(j),
);

final sync = RealtimeSyncEngine(MySyncAdapter());
await showFileShareDialog(context, service: share);
await showRealtimeSyncDialog(context, engine: sync);