We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11100fd commit 9c917b0Copy full SHA for 9c917b0
lib/services/meshcore/buffer_utils.dart
@@ -1,4 +1,5 @@
1
import 'dart:convert';
2
+import 'dart:math' as math;
3
import 'dart:typed_data';
4
5
/// Buffer reader for parsing binary data from MeshCore devices
@@ -206,7 +207,7 @@ class BufferWriter {
206
207
final bytes = Uint8List(maxLength);
208
209
// Copy string bytes up to maxLength - 1
- final copyLength = encoded.length < maxLength - 1 ? encoded.length : maxLength - 1;
210
+ final copyLength = math.min(encoded.length, maxLength - 1);
211
for (int i = 0; i < copyLength; i++) {
212
bytes[i] = encoded[i];
213
}
0 commit comments