From 7c292604eb3e6bf0a3354253f220a8a15cf97d6a Mon Sep 17 00:00:00 2001 From: "CaptainDario @ MBP M1" Date: Sun, 11 Feb 2024 14:30:19 +0100 Subject: [PATCH] dart format --- lib/src/util/byte_conversion_utils.dart | 33 +++++++++++-------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/src/util/byte_conversion_utils.dart b/lib/src/util/byte_conversion_utils.dart index db25d57..2538c67 100644 --- a/lib/src/util/byte_conversion_utils.dart +++ b/lib/src/util/byte_conversion_utils.dart @@ -168,31 +168,28 @@ class ByteConversionUtils { } /// Decodes a TensorFlow string to a List - static List decodeTFStrings(Uint8List bytes){ + static List decodeTFStrings(Uint8List bytes) { /// The decoded string List decodedStrings = []; + /// get the first 32bit int representing num of strings - int numStrings = ByteData.view(bytes.sublist(0,sizeOf()).buffer).getInt32(0, Endian.little); + int numStrings = ByteData.view(bytes.sublist(0, sizeOf()).buffer) + .getInt32(0, Endian.little); /// parse subsequent string position and sizes - for(int s = 0; s < numStrings; s++){ - + for (int s = 0; s < numStrings; s++) { // get current str index - int startIdx = ByteData.view( - bytes.sublist( - (1+s)*sizeOf(), - (2+s)*sizeOf() - ) - .buffer).getInt32(0, Endian.little); + int startIdx = ByteData.view(bytes + .sublist((1 + s) * sizeOf(), (2 + s) * sizeOf()) + .buffer) + .getInt32(0, Endian.little); // get next str index, or in last case the ending byte position - int endIdx = ByteData.view( - bytes.sublist( - (2+s)*sizeOf(), - (3+s)*sizeOf() - ) - .buffer).getInt32(0, Endian.little); - - decodedStrings.add(utf8.decode(bytes.sublist(startIdx,endIdx))); + int endIdx = ByteData.view(bytes + .sublist((2 + s) * sizeOf(), (3 + s) * sizeOf()) + .buffer) + .getInt32(0, Endian.little); + + decodedStrings.add(utf8.decode(bytes.sublist(startIdx, endIdx))); } return decodedStrings;