extractCustomImports method

List<String> extractCustomImports(
  1. GeneratorOptions options
)

Extracts custom imports required for scalar types based on generator options.

This method analyzes all scalar types defined in the schema and determines which custom imports are needed based on the scalar mapping configuration in the generator options. It's used to generate the appropriate import statements in the generated Dart code.

options The generator options containing scalar mapping configuration

Returns a list of import statements needed for custom scalar types

Example:

final imports = schemaService.extractCustomImports(options);
// imports might contain: ['package:my_app/scalars.dart']

Implementation

List<String> extractCustomImports(GeneratorOptions options) {
  return typeVisitor.types.values
      .whereType<ScalarTypeDefinitionNode>()
      .map((type) => gql.importsOfScalar(options, type.name.value))
      .expand((i) => i)
      .toSet()
      .toList();
}