writeFileImports method
void
writeFileImports(
- CppOptions generatorOptions,
- Root root,
- Indent indent, {
- required String dartPackageName,
override
Writes specified imports to indent
.
Implementation
@override
void writeFileImports(
CppOptions generatorOptions,
Root root,
Indent indent, {
required String dartPackageName,
}) {
final String guardName = _getGuardName(generatorOptions.headerIncludePath);
indent.writeln('#ifndef $guardName');
indent.writeln('#define $guardName');
_writeSystemHeaderIncludeBlock(indent, <String>[
'flutter/basic_message_channel.h',
'flutter/binary_messenger.h',
'flutter/encodable_value.h',
'flutter/standard_message_codec.h',
]);
indent.newln();
_writeSystemHeaderIncludeBlock(indent, <String>[
'map',
'string',
'optional',
]);
indent.newln();
if (generatorOptions.namespace != null) {
indent.writeln('namespace ${generatorOptions.namespace} {');
}
indent.newln();
if (generatorOptions.namespace?.endsWith('_pigeontest') ?? false) {
final String testFixtureClass =
'${_pascalCaseFromSnakeCase(generatorOptions.namespace!.replaceAll('_pigeontest', ''))}Test';
indent.writeln('class $testFixtureClass;');
}
indent.newln();
indent.writeln('$_commentPrefix Generated class from Pigeon.');
}