checkIn method
Implementation
Future<Attachment> checkIn(int id, int fileId, int version, File file) async {
final data = FormData();
var fileName = file.path.split('/').last;
fileName = DateFormat('yyMMddhhmmss').format(DateTime.now()) +
fileName.substring(fileName.lastIndexOf('.'));
data.files.add(MapEntry(
fileName,
await MultipartFile.fromFile(
file.path,
contentType: MediaType.parse(lookupMimeType(file.path) ?? ""),
)));
try {
final response = await dio.put('/attachments/$id/$fileId/checkin',
queryParameters: {'version': version}, data: data);
return Attachment.fromJson(response.data);
} on DioException catch (e) {
_handleError(e);
rethrow;
}
}