encode method

String encode([
  1. int lineLength = 64
])

Implementation

String encode([int lineLength = 64]) {
  final encoded = base64.encode(content);
  final builder = StringBuffer();
  builder.writeln('-----BEGIN $type-----');
  for (var i = 0; i < encoded.length; i += lineLength) {
    final chunk = encoded.substring(i, min(i + lineLength, encoded.length));
    builder.writeln(chunk);
  }
  builder.writeln('-----END $type-----');
  return builder.toString();
}