wifi_direct_plugin 0.1.7
wifi_direct_plugin: ^0.1.7 copied to clipboard
A comprehensive Flutter plugin for WiFi Direct (P2P) communication with real-time messaging, file transfer, and cross-platform support for Android and iOS.
Changelog #
All notable changes to this project will be documented in this file.
0.1.7 #
- Extended scanning method add
0.1.6 #
- Optimizing functions and variables globally
0.1.5 #
- Android and ios hot fix
0.1.4 #
- Android and ios saveToDownloads method add
0.1.3 #
- Improved Android and ios stability
0.1.2 #
- android discovery scan bug fix
0.1.1 #
- android & ios with discovery event fix
0.1.0 #
- android & ios with discovery bug fix
0.0.9 #
- android & ios with hot fix
0.0.8 #
- android & ios with reconnection infinity loop bug fix
0.0.7 #
- android & ios with forceRemoveGroup method remove, other bug fix
0.0.6 #
- android & ios with forceRemoveGroup method add
0.0.5 #
- android & ios with startServerSocket,disconnect,closeConnections reconection reset bug fix,
0.0.4 #
- getPeerDisplayInfo, getPeerIpAddress, getFullConnectionStatus,getConnectedDeviceInfo Method add
0.0.3 #
- getCurrentConnectionInfo Method add
0.0.2 #
- connectionStream partial stability improvement
0.0.1 #
Added #
- Initial release of WiFi Direct Plugin for Flutter
- Cross-platform support for Android and iOS
- WiFi Direct P2P connection establishment
- Real-time peer discovery and connection management
- Text message transmission
- File transfer with chunked upload/download
- Image sharing with progress tracking
- Real-time progress indicators for both sender and receiver
- Automatic file saving to Downloads folder
- Connection state management and automatic reconnection
- Advanced error handling and recovery mechanisms
- Support for Android 10+ Scoped Storage
- iOS MultipeerConnectivity framework integration
Features #
-
Connection Management
- Host/Client role selection
- Automatic peer discovery
- One-tap connection to discovered devices
- Connection status monitoring
- Graceful disconnection handling
-
Messaging
- Real-time text messaging
- Instant message delivery
- Message history preservation
- Connection verification before sending
-
File Transfer
- Large file support with chunked transfer
- Real-time progress tracking for sender and receiver
- MD5 checksum verification for data integrity
- Automatic retry mechanism for failed transfers
- Support for all file types (documents, images, videos, etc.)
-
Image Sharing
- Camera capture integration
- Gallery selection support
- Optimized image transfer protocol
- Thumbnail preview in chat
- Interactive image viewer
-
Platform Support
- Android: WiFi Direct (P2P) API with socket communication
- iOS: MultipeerConnectivity framework
- Consistent API across platforms
- Platform-specific optimizations
-
Storage & Permissions
- Android version-specific permission handling
- Scoped Storage support for Android 10+
- Automatic Downloads folder integration
- Smart file naming with duplicate handling
Technical Highlights #
- Native Android implementation using WiFi P2P API
- iOS implementation using MultipeerConnectivity
- Event-driven architecture with Flutter EventChannels
- Efficient memory management and resource cleanup
- Thread-safe socket operations
- Comprehensive error handling and logging
Supported Platforms #
- Android: API level 16+ (Android 4.1+)
- iOS: iOS 9.0+
- Flutter: 3.0.0+
Dependencies #
flutter: SDKcrypto: For MD5 checksum verificationpath_provider: For file system accessfile_picker: For file selectionimage_picker: For camera and gallery accesspermission_handler: For runtime permissionsdevice_info_plus: For device information
Known Limitations #
- iOS implementation requires devices to be in proximity
- Some Android devices may have manufacturer-specific WiFi Direct limitations
- File transfer speed depends on WiFi Direct connection quality
- Maximum file size limited by available device memory
Example Usage #
// Initialize the plugin
await WifiDirectPlugin.initialize();
// Start as host
await WifiDirectPlugin.startAsServer(deviceName: "My Device");
// Start discovery as client
await WifiDirectPlugin.startAsClient();
await WifiDirectPlugin.startDiscovery();
// Send a message
await WifiDirectPlugin.sendText("Hello World!");
// Send a file
await WifiDirectPlugin.sendFile("/path/to/file.pdf");
[Unreleased] #
Planned Features #
- Group chat support (multiple devices)
- End-to-end encryption
- Voice message support
- File compression options
- Custom file transfer protocols
- Background transfer support
- Network quality indicators