build: Remove collection runtime dependency#3680
Conversation
Move nullable iterable helpers into the core SDK and keep collection only for test code that still relies on its equality helpers. Co-Authored-By: GPT-5.5 <[email protected]> Made-with: Cursor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Features
FixesFlutter
DependenciesDeps
Internal Changes
🤖 This preview updates automatically when you update the PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3680 +/- ##
==========================================
- Coverage 86.84% 86.84% -0.01%
==========================================
Files 335 335
Lines 11969 11976 +7
==========================================
+ Hits 10394 10400 +6
- Misses 1575 1576 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Expose the nullable iterable extension through the core SDK barrel so Flutter can consume it the same way it consumes other internal SDK types. Co-Authored-By: GPT-5.5 <[email protected]> Made-with: Cursor
iOS Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| dc53d48 | 1252.06 ms | 1255.61 ms | 3.55 ms |
| 2cb90b9 | 1272.90 ms | 1285.55 ms | 12.66 ms |
| c26ed0a | 1244.11 ms | 1263.85 ms | 19.75 ms |
| f579250 | 1248.14 ms | 1250.15 ms | 2.01 ms |
| 396cb30 | 1265.06 ms | 1265.73 ms | 0.67 ms |
| 0fb3800 | 1256.60 ms | 1266.28 ms | 9.68 ms |
| 57eccdf | 1247.91 ms | 1252.76 ms | 4.84 ms |
| 6f47800 | 1247.52 ms | 1259.37 ms | 11.85 ms |
| 0fb45d0 | 1273.24 ms | 1286.44 ms | 13.19 ms |
| 73a3c38 | 1263.37 ms | 1277.90 ms | 14.53 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| dc53d48 | 5.65 MiB | 6.09 MiB | 446.96 KiB |
| 2cb90b9 | 7.86 MiB | 9.54 MiB | 1.69 MiB |
| c26ed0a | 5.53 MiB | 5.97 MiB | 453.76 KiB |
| f579250 | 5.66 MiB | 6.09 MiB | 448.36 KiB |
| 396cb30 | 5.53 MiB | 6.01 MiB | 488.17 KiB |
| 0fb3800 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 57eccdf | 5.73 MiB | 6.17 MiB | 453.80 KiB |
| 6f47800 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 0fb45d0 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
| 73a3c38 | 7.86 MiB | 9.44 MiB | 1.58 MiB |
Previous results on branch: buenaflor/chore/remove-collection-dependency
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5fff246 | 1248.55 ms | 1253.00 ms | 4.45 ms |
| fe38858 | 1246.36 ms | 1248.63 ms | 2.27 ms |
| 1178cd1 | 1240.13 ms | 1244.35 ms | 4.22 ms |
| 597d219 | 1235.94 ms | 1244.93 ms | 8.99 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5fff246 | 5.73 MiB | 6.18 MiB | 463.45 KiB |
| fe38858 | 5.73 MiB | 6.18 MiB | 463.46 KiB |
| 1178cd1 | 5.73 MiB | 6.18 MiB | 463.91 KiB |
| 597d219 | 5.73 MiB | 6.18 MiB | 463.46 KiB |
Android Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8541716 | 437.14 ms | 443.65 ms | 6.51 ms |
| 4e14113 | 361.52 ms | 353.19 ms | -8.33 ms |
| af96ef2 | 375.84 ms | 382.02 ms | 6.18 ms |
| aaa2730 | 354.04 ms | 370.46 ms | 16.41 ms |
| cfca825 | 417.36 ms | 393.37 ms | -23.99 ms |
| 29e8ebe | 389.91 ms | 395.76 ms | 5.84 ms |
| c5cf749 | 379.18 ms | 360.60 ms | -18.58 ms |
| 0fb3800 | 465.64 ms | 536.77 ms | 71.13 ms |
| aeb02f2 | 373.84 ms | 437.00 ms | 63.16 ms |
| d789735 | 363.95 ms | 358.09 ms | -5.87 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8541716 | 13.93 MiB | 15.00 MiB | 1.06 MiB |
| 4e14113 | 14.09 MiB | 15.28 MiB | 1.19 MiB |
| af96ef2 | 13.93 MiB | 15.18 MiB | 1.25 MiB |
| aaa2730 | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| cfca825 | 14.09 MiB | 15.28 MiB | 1.19 MiB |
| 29e8ebe | 13.93 MiB | 15.06 MiB | 1.13 MiB |
| c5cf749 | 14.31 MiB | 15.49 MiB | 1.19 MiB |
| 0fb3800 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| aeb02f2 | 6.54 MiB | 7.69 MiB | 1.15 MiB |
| d789735 | 13.93 MiB | 15.18 MiB | 1.25 MiB |
Previous results on branch: buenaflor/chore/remove-collection-dependency
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 1178cd1 | 374.83 ms | 360.13 ms | -14.70 ms |
| fe38858 | 435.76 ms | 455.68 ms | 19.92 ms |
| 5fff246 | 382.45 ms | 370.06 ms | -12.38 ms |
| 597d219 | 388.30 ms | 371.53 ms | -16.77 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 1178cd1 | 14.31 MiB | 15.56 MiB | 1.25 MiB |
| fe38858 | 14.31 MiB | 15.56 MiB | 1.25 MiB |
| 5fff246 | 14.31 MiB | 15.56 MiB | 1.25 MiB |
| 597d219 | 14.31 MiB | 15.56 MiB | 1.25 MiB |
Keep iterable utilities scoped to non-null iterables so nullable call sites continue to show explicit null-aware access. Co-Authored-By: GPT-5.5 <[email protected]> Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2556a89. Configure here.
Use explicit static iterable helpers so exported Sentry APIs do not add extension members that can conflict with Dart collection extensions. Co-Authored-By: GPT-5.5 <[email protected]> Co-authored-by: Cursor <[email protected]>
Annotate the static iterable helper as internal so consumers get the intended lint signal even though it is exported for package use. Co-Authored-By: GPT-5.5 <[email protected]> Co-authored-by: Cursor <[email protected]>
Avoid exporting Iterable extension helpers from the public SDK barrel. Sibling packages import the internal helper directly to keep user extension resolution unaffected. Co-Authored-By: GPT-5.5 <[email protected]> Co-authored-by: Cursor <[email protected]>

📜 Description
Removes
collectionfrom runtime dependencies insentry,sentry_flutter, and_sentry_testingby replacing production nullable iterable lookups with a smallSentryIterableUtilsextension in the core SDK.collectionremains available as a dev dependency where tests still use its equality helpers.💡 Motivation and Context
Production code only relied on
firstOrNullandfirstWhereOrNull, so shipping the fullcollectionpackage for runtime use is unnecessary. Keeping those helpers in the core SDK avoids an extra runtime dependency while preserving existing behavior.💚 How did you test it?
fvm dart analyzeon changed Dart SDK filesfvm flutter analyzeon changed Flutter SDK filesfvm dart analyzein_sentry_testingfvm dart test test/utils/iterable_utils_test.dart test/sentry_event_test.dart test/event_processor/exception/io_exception_event_processor_test.dart test/sentry_test.dartfvm flutter test test/integrations/load_contexts_integration_test.dart test/navigation/time_to_display_tracker_test.dart test/navigation/sentry_navigator_observer_test.dart test/feedback/sentry_feedback_widget_test.dartCloses #3679
📝 Checklist
sendDefaultPiiis enabled🔮 Next steps
None.
Made with Cursor