VNAPNIC / flutter_nearby_connections

Flutter plugin support peer-to-peer connectivity and the discovery of nearby devices for Android vs IOS
https://pub.dev/packages/flutter_nearby_connections
BSD 2-Clause "Simplified" License
111 stars 76 forks source link

File resources sharing #8

Open FelixYew opened 3 years ago

FelixYew commented 3 years ago

Possible to implement file sharing with nearby connection.

VNAPNIC commented 3 years ago

No, the current only supports transfer data raw

FelixYew commented 3 years ago

Please consider to include this feature. Thanks

VNAPNIC commented 3 years ago

ok, u can follow the progress here https://github.com/VNAPNIC/flutter_nearby_connections/projects/3

prateekmedia commented 3 years ago

👍 +1 for file sharing

VNAPNIC commented 3 years ago

u can convert image into byte array and byte array to base64 String

like that:

List imageBytes = widget.fileData.readAsBytesSync(); print(imageBytes); String base64Image = base64Encode(imageBytes);

prateekmedia commented 3 years ago

u can convert image into byte array and byte array to base64 String

What if someone wants to build a file sharing app using that, than this hack would not work. :(

ether-how commented 3 years ago

Is there a size limit? I tried sending the base64Image string but I cant receive it on the other device :(

AliAlHourash commented 2 years ago

Is there a size limit? I tried sending the base64Image string but I cant receive it on the other device :(

Did u solve this problem?

ether-how commented 2 years ago

Is there a size limit? I tried sending the base64Image string but I cant receive it on the other device :(

Did u solve this problem?

Kind of. Since they're already in a base64 string, i split them up into strings of 1500 length and sent them one by one with the max number of parts and corresponding part number attached. Once the receiver receives the the last part, do a check if the number of parts received is equal to the max number of parts. Then if nothing is missing, merge them into a single string and convert it to whatever you want. Eg. Image, File etc. I did this for images and voice recordings.

serzhikdnepr commented 2 years ago

Kind of.

@ether-how Can you provide a more detailed example?