build method
Generates the outputs for a given BuildStep
.
Implementation
@override
FutureOr<void> build(BuildStep buildStep) async {
if (buildStep.inputId.path == r'lib/$lib$' && config.schemaId != null) {
final _generatedFiles = Glob('lib/**.gql.dart');
final _excludeFiles = <Glob>[];
if (config.schemaIds != null) {
for (final schemaId in config.schemaIds!) {
var dirPath = p.dirname(schemaId.path);
_excludeFiles.add(Glob('$dirPath/**.gql.dart'));
}
}
await buildSchema(
buildStep, config.schemaId!, _generatedFiles, _excludeFiles);
}
if (config.schemaIds != null) {
for (final schemaId in config.schemaIds!) {
if (schemaId == buildStep.inputId) {
var dirPath = p.dirname(schemaId.path);
final _generatedFiles = Glob('$dirPath/**.gql.dart');
await buildSchema(buildStep, schemaId, _generatedFiles, []);
break;
}
}
}
}