You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I use retrofit with dio_smart_retry package. I want to have ability to retry multipart requests with files. In dio_smart_retry this is done by MultipartFileRecreatable package. I wish retrofit had support to this.
Describe the solution you'd like
I understand that retrofit package will never be dependent of another package like dio_smart_retry. But maybe there's a possibility to have another package which just dio_smart_retry for retrofit.
I've tried to fork retrofit locally and found out that make generator to generate MultipartFileRecreatable instead of MultipartFile is quite simple
// generator.dart. Line 1825.
final isRecreatable = r.peek('recreatable')?.boolValue ?? false; // I've just added `bool recreatable` property to Part annotation but of course this should be done another way
final uploadFileInfo = refer(
'${isRecreatable ? MultipartFileRecreatable : MultipartFile}.fromFileSync') // this is where code generated MultipartFile.fromFileSync
.call([
refer(p.displayName).property('path')
], {
'filename': fileName,
if (contentType != null)
'contentType':
refer('MediaType', 'package:http_parser/http_parser.dart')
.property('parse')
.call([literal(contentType)])
});
Describe alternatives you've considered
The only alternative right now is to use Dio instead of retrofit in cases when multipart requests with files needs to be retried.
Additional context
There were only one issue in dio_smart_retry about this case rodion-m/dio_smart_retry#39. I guess there's no way to do it without retrofit support
The text was updated successfully, but these errors were encountered:
I'm sorry. In first version of my comment above I mentioned that FileSystemException: File closed happens with my attempt to generate MultipartFileRecreatable instead of MultipartFile. But now I guess this exception happens only in my project, so I removed the mention of this exception
Is your feature request related to a problem? Please describe.
I use retrofit with dio_smart_retry package. I want to have ability to retry multipart requests with files. In dio_smart_retry this is done by MultipartFileRecreatable package. I wish retrofit had support to this.
Describe the solution you'd like
I understand that retrofit package will never be dependent of another package like dio_smart_retry. But maybe there's a possibility to have another package which just dio_smart_retry for retrofit.
I've tried to fork retrofit locally and found out that make generator to generate MultipartFileRecreatable instead of MultipartFile is quite simple
Describe alternatives you've considered
The only alternative right now is to use Dio instead of retrofit in cases when multipart requests with files needs to be retried.
Additional context
There were only one issue in dio_smart_retry about this case rodion-m/dio_smart_retry#39. I guess there's no way to do it without retrofit support
The text was updated successfully, but these errors were encountered: