From 751ce143dac9fc44ef3a720ac681df95769a2d17 Mon Sep 17 00:00:00 2001 From: reasje Date: Fri, 2 Aug 2024 16:47:51 +0330 Subject: [PATCH] fix: List length error --- .../blueberry_ring/utils/blueberry_commands_utils.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/features/common/packages/bluetooth/blueberry_ring/utils/blueberry_commands_utils.dart b/lib/features/common/packages/bluetooth/blueberry_ring/utils/blueberry_commands_utils.dart index 5f079853..79c5a1a2 100644 --- a/lib/features/common/packages/bluetooth/blueberry_ring/utils/blueberry_commands_utils.dart +++ b/lib/features/common/packages/bluetooth/blueberry_ring/utils/blueberry_commands_utils.dart @@ -24,7 +24,8 @@ class BlueberryCommandsUtils { static List> splitArrayByLength(List arr, int length) { List> result = []; for (int i = 0; i < arr.length; i += length) { - result.add(arr.sublist(i, i + length)); + int end = (i + length < arr.length) ? i + length : arr.length; + result.add(arr.sublist(i, end)); } return result; }