PackageVersionNumberGeneralLibraryConstraint.intersection constructor

PackageVersionNumberGeneralLibraryConstraint.intersection(
  1. Iterable<PackageVersionNumberGeneralLibraryConstraint> constraints
)

Creates a new version constraint that is the intersection of constraints.

It only allows versions that all of those constraints allow. If constraints is empty, then it returns a PackageVersionNumberGeneralLibraryConstraint that allows all versions.

Implementation

factory PackageVersionNumberGeneralLibraryConstraint.intersection(
    Iterable<PackageVersionNumberGeneralLibraryConstraint> constraints) {
  var constraint = PackageVersionNumberGeneralLibraryRange();
  for (var other in constraints) {
    constraint = constraint.intersect(other)
        as PackageVersionNumberGeneralLibraryRange;
  }
  return constraint;
}