acceptsProfiles method

  1. @override
bool acceptsProfiles(
  1. Profiles profiles
)
override

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

Implementation

@override
bool acceptsProfiles(Profiles profiles) => profiles.matches((profile) => isProfileActive(profile));