writeBinaryDescriptor method

void writeBinaryDescriptor(
  1. IndentingWriter out,
  2. String identifierName,
  3. String name,
  4. GeneratedMessage descriptor,
)

Implementation

void writeBinaryDescriptor(IndentingWriter out, String identifierName,
    String name, GeneratedMessage descriptor) {
  final base64 = base64Encode(descriptor.writeToBuffer());
  out.println('/// Descriptor for `$name`. Decode as a '
      '`${descriptor.info_.qualifiedMessageName}`.');

  const indent = '    ';

  final base64Lines =
      _splitString(base64, 74).map((s) => "'$s'").join('\n$indent');
  out.println('final $_typedDataImportPrefix.Uint8List '
      '$identifierName = '
      '$_convertImportPrefix.base64Decode(\n$indent$base64Lines);');
}