This project demonstrates how to pair and send data between two devices connected via a WiFi hotspot using Flutter. It uses the wifi_iot package to create a hotspot and the socket_io_client package to establish a client-server model for data transfer.
- Create a WiFi hotspot
- Connect to a WiFi hotspot
- Send data from a client to a server over the hotspot
- Receive data on the server
- Flutter SDK
- Dart SDK
- Clone the repository:
git clone https://github.com/jasimameen/p2p-transfer-transfer.git
- Navigate to the project directory:
cd p2p-transfer
- Install dependencies:
flutter pub get
To create a hotspot, call the createHotspot function.
To connect to a hotspot, call the connectToHotspot function with the SSID and password of the hotspot.
To send data, call the createClientAndSendData function with the data you want to send.
To receive data, call the createServer function. The server will listen for incoming connections and print received data to the console.
Remember to add necessary permissions in your AndroidManifest.xml for Android and Info.plist for iOS. For Android, you would typically need ACCESS_FINE_LOCATION, CHANGE_WIFI_STATE, and ACCESS_WIFI_STATE permissions. For iOS, you'll need to add NSLocalNetworkUsageDescription in your Info.plist.
Contributions are welcome! Please read our contributing guidelines to get started.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Jasim Ameen