@@ -20,7 +20,7 @@ ClientBase createClient({
2020 );
2121
2222class ClientIO extends ClientBase with ClientMixin {
23- static const int CHUNK_SIZE = 5*1024*1024;
23+ static const int chunkSize = 5*1024*1024;
2424 String _endPoint;
2525 Map<String , String >? _headers;
2626 @override
@@ -120,7 +120,7 @@ class ClientIO extends ClientBase with ClientMixin {
120120 }
121121
122122 late Response res;
123- if (size < = CHUNK_SIZE ) {
123+ if (size < = chunkSize ) {
124124 if (file.path != null) {
125125 params[paramName] = await http.MultipartFile.fromPath(
126126 paramName, file.path!,
@@ -143,11 +143,11 @@ class ClientIO extends ClientBase with ClientMixin {
143143 try {
144144 res = await call(
145145 HttpMethod.get,
146- path: path + '/' + params[idParamName],
146+ path: '$path/${ params[idParamName]}' ,
147147 headers: headers,
148148 );
149149 final int chunksUploaded = res.data['chunksUploaded'] as int;
150- offset = chunksUploaded * CHUNK_SIZE ;
150+ offset = chunksUploaded * chunkSize ;
151151 } on {{spec .title | caseUcfirst }}Exception catch (_) {}
152152 }
153153
@@ -160,19 +160,19 @@ class ClientIO extends ClientBase with ClientMixin {
160160 while (offset < size) {
161161 List<int > chunk = [];
162162 if (file.bytes != null) {
163- final end = min(offset + CHUNK_SIZE , size);
163+ final end = min(offset + chunkSize , size);
164164 chunk = file.bytes!.getRange(offset, end).toList();
165165 } else {
166166 raf!.setPositionSync(offset);
167- chunk = raf.readSync(CHUNK_SIZE );
167+ chunk = raf.readSync(chunkSize );
168168 }
169169 params[paramName] =
170170 http.MultipartFile.fromBytes(paramName, chunk, filename: file.filename);
171171 headers['content-range'] =
172- 'bytes $offset-${min<int >((offset + CHUNK_SIZE - 1), size - 1)}/$size';
172+ 'bytes $offset-${min<int >((offset + chunkSize - 1), size - 1)}/$size';
173173 res = await call(HttpMethod.post,
174174 path: path, headers: headers, params: params);
175- offset += CHUNK_SIZE ;
175+ offset += chunkSize ;
176176 if (offset < size) {
177177 headers['x-{{spec .title | caseLower }}-id'] = res.data['\$id'];
178178 }
0 commit comments