hexToU8aStream function

Uint8List hexToU8aStream(
  1. String value
)

Implementation

Uint8List hexToU8aStream(String value) {
  var _value = hexStripPrefix(value);
  Uint8List results = Uint8List((_value.length / 2).ceil());
  // ignore: prefer_typing_uninitialized_variables
  var sink;
  // ignore: close_sinks
  var controller = StreamController<List<int>>(sync: true);
  controller.stream.listen((data) {
    results.setAll(0, data);
  });
  sink = hex.decoder.startChunkedConversion(controller.sink);
  sink.add(_value);
  return results;
}