Home > Software design >  Convert a hexadecimal string into list of integers
Convert a hexadecimal string into list of integers

Time:05-01

Similar to this question here but for flutter/dart: Easier / better way to convert hexadecimal string to list of numbers in Python?

I have a string with hexadecimal value like 09F911029D74E35BD84156C5635688C0 and I want to return [9, 249, 17, 2, 157, 116, 227, 91, 216, 65, 86, 197, 99, 86, 136, 192]. In python I can just use list(binascii.unhexlify('09F911029D74E35BD84156C5635688C0')). Is there such a function for flutter/dart?

CodePudding user response:

Try the Package convert to decode or encode your hex values into desired values

var hex = 09F911029D74E35BD84156C5635688C0;
var result = hex.decode(hex);

Remember to initialize the code HexDecoder (hex) first

also import 'package:convert/convert.dart';

let me know if this works .

  • Related