Skip to content

Allow built_collection 6.0.0 - #1406

Closed
arrrrny wants to merge 1 commit into
google:masterfrom
arrrrny:widen-built-collection-1405
Closed

arrrrny wants to merge 1 commit into
google:masterfrom
arrrrny:widen-built-collection-1405

Conversation

@arrrrny

@arrrrny arrrrny commented Nov 17, 2026

Copy link
Copy Markdown

What

Widens the built_collection constraint in built_value/pubspec.yaml:

-  built_collection: ^5.0.0
+  built_collection: '>=5.1.1 <7.0.0'

Why

built_collection 6.0.0 was published on 2026-10-26, but built_value still pins ^5.0.0, so every consumer of built_value is held on 5.x. The rest of the build stack has already widened:

Package Latest Constraint on built_collection
code_builder 4.13.0 >=5.1.1 <7.0.0 — allows 6.0.0
build_runner 2.17.1 >=5.1.1 <7.0.0 — allows 6.0.0
build_daemon 4.1.7 >=5.0.0 <7.0.0 — allows 6.0.0
built_value 8.13.0 ^5.0.0 — blocks 6.0.0

A consumer that declares built_collection: ^6.0.0 next to build_runner cannot solve:

Because build_runner >=2.8.0 depends on built_value ^8.10.1 which depends on
built_collection ^5.0.0, build_runner >=2.8.0 requires built_collection ^5.0.0.

This matches the lower bound the other three already declare, so it does not narrow anything that resolves today — it only admits 6.x. Discussion: #1405.

The 6.0.0 break, and why it does not bite here

The changelog flags one behavioural change: BuiltList.asList, BuiltMap.asMap, BuiltListMultimap.asMap and BuiltSetMultimap.asMap now return unmodifiable views instead of copies.

built_value calls asMap() in exactly one place, Serializers.merge (built_value/lib/src/built_json_serializers.dart:295):

_builderFactories.addAll(serializers.builderFactories.asMap());

The receiver is a plain Dart Map, and the BuiltMap view is only read from, so returning a view instead of a copy is fine. There are no other asList() / asMap() call sites in built_value/lib or built_value_generator/lib.

Verification

Resolved locally against built_collection 6.0.0:

  • dart analyze — clean in built_value, built_value_generator, built_value_test.
  • dart test — built_value 252 passed, built_value_generator 106 passed, built_value_test 11 passed.

A CHANGELOG.md entry is left to the maintainer, since the release tooling owns the version heading.

built_collection 6.0.0 was published on 2026-10-26, but built_value still
pins ^5.0.0, so every consumer of built_value is held on 5.x. code_builder
(4.13.0), build_runner (2.17.1) and build_daemon (4.1.7) already declare
>=5.1.1 <7.0.0 and allow 6.0.0, which makes this constraint the sole
remaining blocker (google#1405).

The one breaking change in 6.0.0 is that BuiltList.asList, BuiltMap.asMap,
BuiltListMultimap.asMap and BuiltSetMultimap.asMap return unmodifiable
views instead of copies. built_value itself calls asMap() only on the
BuiltMap of builder factories in Serializers.merge, where the result is
read through addAll, so an unmodifiable view is fine here.

Verified locally with built_collection 6.0.0 resolved: dart analyze is
clean and the suites pass -- built_value 252 tests, built_value_generator
106 tests, built_value_test 11 tests.

Fixes google#1405.
@davidmorgan

Copy link
Copy Markdown
Collaborator

Thanks! built_value isn't maintained here, it's over at the "build" repo; sorry about that. I'll do the version bump over there and release.

dart-lang/build#5270

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants