toBinArray method
Place the hex file into a binary array
Implementation
Uint8List toBinArray({int? start, int? end, int? pad, int? size, bool isApplication = false}){
//Return binary array.
pad ??= padding;
List<int> bin = [];
if(buffer == {}){
throw Exception("No Data in buffer");
}
if(size != null && size <= 0){
throw Exception("tobinarray: wrong value for size");
}
List<int> temp = _getStartEnd(start, end, size);
start = temp[0];
end = isApplication?temp[1]:min(temp[1],largest);
for(int i = start; i < end+1; i++){
if(buffer[i+pad] != null){
bin.add(buffer[i+pad]!);
}
}
return Uint8List.fromList(bin);
}