writeGeneralUtilities method

  1. @override
void writeGeneralUtilities(
  1. ObjcOptions generatorOptions,
  2. Root root,
  3. Indent indent, {
  4. 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(
  ObjcOptions 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);

  if (hasHostApi) {
    _writeWrapError(indent);
    indent.newln();
  }
  if (hasFlutterApi) {
    _writeCreateConnectionError(indent);
    indent.newln();
  }

  if (hasHostApi || hasFlutterApi) {
    _writeGetNullableObjectAtIndex(indent);
  }

  if (root.requiresOverflowClass) {
    _writeDataClassDeclaration(
      generatorOptions,
      root,
      indent,
      _overflowClass,
    );
  }
}