writeGeneralUtilities method
void
writeGeneralUtilities(
- SwiftOptions 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(
SwiftOptions generatorOptions,
Root root,
Indent indent, {
required String dartPackageName,
}) {
final bool hasHostApi = root.apis
.whereType<AstHostApi>()
.any((Api api) => api.methods.isNotEmpty);
final bool hasFlutterApi = root.apis
.whereType<AstFlutterApi>()
.any((Api api) => api.methods.isNotEmpty);
final bool hasProxyApi = root.apis.any((Api api) => api is AstProxyApi);
if (generatorOptions.includeErrorClass) {
_writePigeonError(generatorOptions, indent);
}
if (hasHostApi || hasProxyApi) {
_writeWrapResult(indent);
_writeWrapError(generatorOptions, indent);
}
if (hasFlutterApi || hasProxyApi) {
_writeCreateConnectionError(generatorOptions, indent);
}
_writeIsNullish(indent);
_writeNilOrValue(indent);
}