dump method

String dump({
  1. int spaces = 0,
})

Creates a readable dump from the current ASN1Object.

Important note: Subclasses need to override this method. If the ASN1Object is constructed and has child elements, dump() has to be called for each child element.

Implementation

String dump({int spaces = 0}) {
  var sb = StringBuffer();
  for (var i = 0; i < spaces; i++) {
    sb.write(' ');
  }
  if (tag == 0xA0 || tag == 0xA3) {
    sb.write('[$tag]');
    var parser = ASN1Parser(valueBytes);
    if (parser.hasNext()) {
      var next = parser.nextObject();
      var dump = next.dump(spaces: spaces + dumpIndent);
      sb.write('\n$dump');
    } else {
      sb.write(' (0 elem)');
    }
  }
  return sb.toString();
}