writeGeneralUtilities method
void
writeGeneralUtilities(
- CppOptions generatorOptions,
- Root root,
- Indent indent, {
- required String dartPackageName,
override
Writes any necessary helper utilities to indent
if needed.
This method is not required, and does not need to be overridden.
Implementation
@override
void writeGeneralUtilities(
CppOptions generatorOptions,
Root root,
Indent indent, {
required String dartPackageName,
}) {
final List<String> usingDirectives = <String>[
'flutter::BasicMessageChannel',
'flutter::CustomEncodableValue',
'flutter::EncodableList',
'flutter::EncodableMap',
'flutter::EncodableValue',
];
usingDirectives.sort();
for (final String using in usingDirectives) {
indent.writeln('using $using;');
}
indent.newln();
_writeFunctionDefinition(indent, 'CreateConnectionError',
returnType: 'FlutterError',
parameters: <String>['const std::string channel_name'], body: () {
indent.format('''
return FlutterError(
"channel-error",
"Unable to establish connection on channel: '" + channel_name + "'.",
EncodableValue(""));''');
});
}