acceptsProfiles method
Profile Predicate Evaluation
Evaluates a Profiles predicate against the current environment. This method should be preferred over matchesProfiles when the caller already has a compiled Profiles object for efficiency.
Example
final profiles = Profiles.of(['staging | prod']);
if (env.acceptsProfiles(profiles)) {
connectToProductionDb();
}
Behavior
- Executes the predicate using the environment’s active or default profiles.
- Allows reuse of compiled Profiles across multiple evaluations.
Notes
- Use matchesProfiles for quick ad-hoc checks.
- Use acceptsProfiles when evaluating the same expression repeatedly.
Implementation
@override
bool acceptsProfiles(Profiles profiles) => profiles.matches((profile) => isProfileActive(profile));