writeGeneralUtilities method
void
writeGeneralUtilities(
- DartOptions 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(
DartOptions generatorOptions,
Root root,
Indent indent, {
required String dartPackageName,
}) {
final bool hasHostMethod = root.apis
.whereType<AstHostApi>()
.any((AstHostApi api) => api.methods.isNotEmpty) ||
root.apis.whereType<AstProxyApi>().any((AstProxyApi api) =>
api.constructors.isNotEmpty ||
api.attachedFields.isNotEmpty ||
api.hostMethods.isNotEmpty);
final bool hasFlutterMethod = root.apis
.whereType<AstFlutterApi>()
.any((AstFlutterApi api) => api.methods.isNotEmpty) ||
root.apis.any((Api api) => api is AstProxyApi);
if (hasHostMethod) {
_writeCreateConnectionError(indent);
}
if (hasFlutterMethod || generatorOptions.testOutPath != null) {
_writeWrapResponse(generatorOptions, root, indent);
}
}