Skip to content

Commit 049b7c0

Browse files
ChiragAgg5kclaude
andcommitted
Fix Flutter constant naming: CHUNK_SIZE to chunkSize
Changed CHUNK_SIZE constant to chunkSize in Flutter templates to follow Dart's lowerCamelCase naming convention for constants, addressing the constant_identifier_names lint warning. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent c30701f commit 049b7c0

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

templates/flutter/lib/src/client.dart.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'upload_progress.dart';
1010
/// The [Client] is also responsible for managing user's sessions.
1111
abstract class Client {
1212
/// The size for cunked uploads in bytes.
13-
static const int CHUNK_SIZE = 5 * 1024 * 1024;
13+
static const int chunkSize = 5 * 1024 * 1024;
1414

1515
/// Holds configuration such as project.
1616
late Map<String, String> config;

templates/flutter/lib/src/client_browser.dart.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ClientBase createClient({required String endPoint, required bool selfSigned}) =>
1616
ClientBrowser(endPoint: endPoint, selfSigned: selfSigned);
1717

1818
class ClientBrowser extends ClientBase with ClientMixin {
19-
static const int CHUNK_SIZE = 5 * 1024 * 1024;
19+
static const int chunkSize = 5 * 1024 * 1024;
2020
String _endPoint;
2121
Map<String, String>? _headers;
2222
@override
@@ -130,7 +130,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
130130
int size = file.bytes!.length;
131131

132132
late Response res;
133-
if (size <= CHUNK_SIZE) {
133+
if (size <= chunkSize) {
134134
params[paramName] = http.MultipartFile.fromBytes(
135135
paramName,
136136
file.bytes!,
@@ -154,28 +154,28 @@ class ClientBrowser extends ClientBase with ClientMixin {
154154
headers: headers,
155155
);
156156
final int chunksUploaded = res.data['chunksUploaded'] as int;
157-
offset = chunksUploaded * CHUNK_SIZE;
157+
offset = chunksUploaded * chunkSize;
158158
} on {{spec.title | caseUcfirst}}Exception catch (_) {}
159159
}
160160

161161
while (offset < size) {
162162
List<int> chunk = [];
163-
final end = min(offset + CHUNK_SIZE, size);
163+
final end = min(offset + chunkSize, size);
164164
chunk = file.bytes!.getRange(offset, end).toList();
165165
params[paramName] = http.MultipartFile.fromBytes(
166166
paramName,
167167
chunk,
168168
filename: file.filename,
169169
);
170170
headers['content-range'] =
171-
'bytes $offset-${min<int>((offset + CHUNK_SIZE - 1), size - 1)}/$size';
171+
'bytes $offset-${min<int>((offset + chunkSize - 1), size - 1)}/$size';
172172
res = await call(
173173
HttpMethod.post,
174174
path: path,
175175
headers: headers,
176176
params: params,
177177
);
178-
offset += CHUNK_SIZE;
178+
offset += chunkSize;
179179
if (offset < size) {
180180
headers['x-{{spec.title | caseLower }}-id'] = res.data['\$id'];
181181
}

templates/flutter/lib/src/client_io.dart.twig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ ClientBase createClient({required String endPoint, required bool selfSigned}) =>
2222
ClientIO(endPoint: endPoint, selfSigned: selfSigned);
2323

2424
class ClientIO extends ClientBase with ClientMixin {
25-
static const int CHUNK_SIZE = 5 * 1024 * 1024;
25+
static const int chunkSize = 5 * 1024 * 1024;
2626
String _endPoint;
2727
Map<String, String>? _headers;
2828
@override
@@ -244,7 +244,7 @@ class ClientIO extends ClientBase with ClientMixin {
244244
}
245245

246246
late Response res;
247-
if (size <= CHUNK_SIZE) {
247+
if (size <= chunkSize) {
248248
if (file.path != null) {
249249
params[paramName] = await http.MultipartFile.fromPath(
250250
paramName,
@@ -276,7 +276,7 @@ class ClientIO extends ClientBase with ClientMixin {
276276
headers: headers,
277277
);
278278
final int chunksUploaded = res.data['chunksUploaded'] as int;
279-
offset = chunksUploaded * CHUNK_SIZE;
279+
offset = chunksUploaded * chunkSize;
280280
} on {{spec.title | caseUcfirst}}Exception catch (_) {}
281281
}
282282

@@ -289,26 +289,26 @@ class ClientIO extends ClientBase with ClientMixin {
289289
while (offset < size) {
290290
List<int> chunk = [];
291291
if (file.bytes != null) {
292-
final end = min(offset + CHUNK_SIZE, size);
292+
final end = min(offset + chunkSize, size);
293293
chunk = file.bytes!.getRange(offset, end).toList();
294294
} else {
295295
raf!.setPositionSync(offset);
296-
chunk = raf.readSync(CHUNK_SIZE);
296+
chunk = raf.readSync(chunkSize);
297297
}
298298
params[paramName] = http.MultipartFile.fromBytes(
299299
paramName,
300300
chunk,
301301
filename: file.filename,
302302
);
303303
headers['content-range'] =
304-
'bytes $offset-${min<int>((offset + CHUNK_SIZE - 1), size - 1)}/$size';
304+
'bytes $offset-${min<int>((offset + chunkSize - 1), size - 1)}/$size';
305305
res = await call(
306306
HttpMethod.post,
307307
path: path,
308308
headers: headers,
309309
params: params,
310310
);
311-
offset += CHUNK_SIZE;
311+
offset += chunkSize;
312312
if (offset < size) {
313313
headers['x-{{spec.title | caseLower }}-id'] = res.data['\$id'];
314314
}

0 commit comments

Comments
 (0)