shouldGenerateFor method
Determines whether this builder should generate output for the given candidate.
This method combines the generateFor patterns with the builder's own
shouldBuildFor
logic to determine if the builder should process the file.
candidate
The build candidate to check.
Returns true if this builder should process the candidate.
Implementation
@override
bool shouldGenerateFor(BuildCandidate candidate) {
if (generateFor.isNotEmpty) {
for (final String pattern in generateFor) {
final Glob glob = Glob(pattern);
if (glob.matches(candidate.asset.uri.path)) {
for (final Builder builder in builders) {
if (builder.shouldBuildFor(candidate)) {
return true;
}
}
}
return false;
}
}
for (final Builder builder in builders) {
if (builder.shouldBuildFor(candidate)) {
return true;
}
}
return false;
}