id_pair_set 2.0.0
id_pair_set: ^2.0.0 copied to clipboard
An immutable set of identifiers keyed by type, with explicit duplicate reporting and JSON round-tripping: one id per namespace for the same thing.
2.0.0 - 2026-09-19 #
Rebuilt so a catalog, a loader or a diff gate can trust the value.
Added #
IdPair<T>— the id type keeps its static type (an enum, a string), replacing thedynamicgetter.propsis implemented by the base, so subclasses only override what they add.SimpleIdPair— the concrete string-keyed pair, so the common case needs no subclass.toJson,IdPairSet.fromJson(with a pair builder) andIdPairSet.fromPlainJson— a wire format that round-trips, replacing the unparseabletoString.duplicatesandhasDuplicates— every pair displaced by a duplicate id type is reported instead of vanishing.DuplicatePolicy(firstWins/lastWins) — the duplicate rule is named rather than a bare boolean.operator [],contains,containsCode,containsType,idTypes,length,isEmpty,isNotEmpty,policy,pairs.remove(exact pair) andremoveType(whatever code a type held).idTypeKey— the one definition of how an id type is named on the wire, so a stored key and a looked-up key cannot drift.
Changed #
- Equality and
hashCodeare order-insensitive: two sets holding the same pairs are equal however they were built. Previously a no-opaddPairof an identical pair reordered the set and broke equality whiletoStringstayed identical. addis an explicit upsert: the incoming pair wins for its type.toStringis documented as a display rendering, not a wire format (a code may contain the:and|separators).- SDK constraint is now
>=3.10.0 <4.0.0;equatable ^2.1.0(the deprecatedEquatableMixinis gone, so the package analyzes clean at--fatal-infos).
Removed #
idPairs(renamedpairs),getByType(replaced byoperator []andpairs),keepLast(replaced byDuplicatePolicy), andaddPair/removePair(renamedadd/remove).