prefixInt function

List prefixInt(
  1. int length,
  2. int hexLength
)

Implementation

List prefixInt(int length, int hexLength) {
  /// The length for the text or the position of the symbol is converted to hexadecimal and then a colon (0x3a) is added. If hexLength is 1, then a 4
  /// is added or if hexLength is 2, then a 6 is added. The numbers represent the length of the hexadecimal values.
  List codeUnits = length.toString().codeUnits;
  List lengthList = [
    for (int a = 0; a < codeUnits.length; a++) codeUnits[a].toRadixString(16),
    "3a"
  ];

  if (hexLength == 1) {
    lengthList.insertAll(lengthList.length - 1, ["2e", "34"]);
  } else if (hexLength == 2) {
    lengthList.insertAll(lengthList.length - 1, ["2e", "36"]);
  }

  return lengthList;
}