writeFileImports method
void
writeFileImports(
- SwiftOptions generatorOptions,
- Root root,
- Indent indent, {
- required String dartPackageName,
override
Writes specified imports to indent
.
Implementation
@override
void writeFileImports(
SwiftOptions generatorOptions,
Root root,
Indent indent, {
required String dartPackageName,
}) {
indent.writeln('import Foundation');
final Iterable<String> proxyApiImports = root.apis
.whereType<AstProxyApi>()
.map((AstProxyApi proxyApi) => proxyApi.swiftOptions?.import)
.nonNulls
.toSet();
for (final String import in proxyApiImports) {
indent.writeln('import $import');
}
indent.newln();
indent.format('''
#if os(iOS)
import Flutter
#elseif os(macOS)
import FlutterMacOS
#else
#error("Unsupported platform.")
#endif''');
}