buildSchemaLibrary function
Library
buildSchemaLibrary(
- SourceNode schemaSource,
- String partUrl,
- Map<
String, Reference> typeOverrides, - EnumFallbackConfig enumFallbackConfig, {
- bool generatePossibleTypesMap = false,
- Allocator? allocator,
- TriStateValueConfig triStateValueConfig = TriStateValueConfig.never,
- bool generateVarsCreateFactories = false,
Implementation
Library buildSchemaLibrary(SourceNode schemaSource, String partUrl,
Map<String, Reference> typeOverrides, EnumFallbackConfig enumFallbackConfig,
{bool generatePossibleTypesMap = false,
Allocator? allocator,
TriStateValueConfig triStateValueConfig = TriStateValueConfig.never,
bool generateVarsCreateFactories = false}) {
final lib = buildSchema(
schemaSource,
typeOverrides,
enumFallbackConfig,
allocator ?? Allocator(),
triStateValueConfig,
generateVarsCreateFactories) as Library;
final Code? possibleTypes;
if (generatePossibleTypesMap && lib.body.isNotEmpty) {
possibleTypes = buildPossibleTypes(schemaSource.document);
} else {
possibleTypes = null;
}
return lib.rebuild(
(b) {
b.directives.add(
Directive.part(partUrl),
);
if (possibleTypes != null) {
b.body.add(possibleTypes);
}
return b;
},
);
}