Hi
Please is it possible to implement an IPFS mobile app with Flutter. Thanks
1 Like
Please be more descriptive while asking a question. The more data you share in a systematic manner, the easier it would be for people to answer your question. Cheers.
Thank you for the advise
I’m tring to build a mobile app using IFPS protocol so that customer can share file Between them. I could’n find a plugin who can help me.
e.g: dart_ipfs_client but it’s not working
- is it possible to do it using Flutter?
- is there any Flutter plugin who can help me?
thanks
1 Like
- Yes it’s possible, I use infura as ipfs RPC
- No, just use the http client package, I prefer use dio package.
This is my sample code:
Future<IpfsUploadModel> uploadImage({
required File image,
}) async {
try {
final Response response = await dio.post(UrlsConfig.infuraIPFS + 'add?',
data: FormData.fromMap({
'file': await MultipartFile.fromFile(
image.path,
filename: image.path.split('/').last,
),
}),
queryParameters: {
'pin': false,
'cid-version': 1,
},
options: Options(
headers: {
'Authorization': 'Basic ${KeysConfig.infuraIPFSPrivateKey}',
},
), onSendProgress: (received, total) {
if (total != -1) {
print(
'Upload Image to IPFS ${(received / total * 100).toStringAsFixed(0)}%');
}
});
print("========== SUCCESS UPLOAD IMAGE =========");
print(response.data);
return IpfsUploadModel.fromJson(response.data);
} on DioError catch (error) {
throw error;
}
}