PackageTrack
Sign in Get early access

fast_immutable_collections

Immutable lists, sets, maps, and multimaps, which are as fast as their native mutable counterparts. Extension methods and comparators for native Dart collections.

11.2.0 138K downloads/mo #990 most downloaded on pub.dev marcglasberg/fast_immutable_collections

What this package is like to depend on

Last release 4 months ago

14 Apr 2026

Release timing varies

gaps range from 9 days to 7 months

Rarely documented

notes for 20 of 100 stable releases

Nothing withdrawn

no release was ever pulled

6 years old

120 releases · first in 2021

2 releases in the last 12 months

see the full history below

Release timeline

120 releases · Jan 2021 to Apr 2026
2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 60 of 120
  1. 11.2.0 14 Apr 2026
    Release notes
    • Added cached method and CacheKey class for caching derived computations on IList, ISet, and IMap.

      Since immutable collections never change, any value derived from their contents is stable and can be safely cached. The new cached method lets you lazily compute and cache a derived value (like an index map) inside the collection instance itself, so subsequent calls return the cached result in O(1).

      Define a CacheKey<C, R> that pairs a cache identity with a typed computation function. Use static final or top-level variables for keys so the same object reference is reused across calls:

      class PairState {
        final IList<Pair> pairs;
      
        static final _byId = CacheKey<IList<Pair>, Map<Id, Pair>>(
          (list) => {for (var p in list) p.id: p},
        );
      
        Pair? findById(Id id) => pairs.cached(_byId)[id];
      }
      

      The first call to cached builds the map in O(n) and caches it. Every subsequent call is O(1). When the collection is replaced with a new instance (e.g., an item is added), the old cache is garbage-collected with the old instance, and the new one builds its own cache on first access.

      Multiple cache keys can be used on the same collection, each caching independently:

      static final _byId = CacheKey<IList<User>, Map<String, User>>(
        (list) => {for (var u in list) u.id: u},
      );
      
      static final _byEmail = CacheKey<IList<User>, Map<String, User>>(
        (list) => {for (var u in list) u.email: u},
      );
      

      Notes:

      • The cache adds zero overhead to collections that don't use it (a single null pointer).
      • The cache survives flush() since the collection identity is preserved.
      • Constant collections (const IList.empty(), const IListConst(...), etc.) support cached but compute the value each time without caching, since they cannot hold mutable state.
      • CacheKey can be const when using a static or top-level function reference.
    Open source →
  2. 11.1.0 24 Oct 2025
    Release notes
    • Added helper extension method IList<IList<T>>.putXY() for setting values in
      2D lists, using x,y coordinates.
    Open source →
  3. 11.0.4 08 Apr 2025
    Release notes
    • Doc improvements.
    Open source →
  4. 11.0.3 06 Jan 2025

    Nothing published for this version

  5. 11.0.2 02 Jan 2025

    Nothing published for this version

  6. 11.0.1 01 Jan 2025

    Nothing published for this version

  7. 11.0.0 29 Oct 2024

    Nothing published for this version

  8. 10.2.4 29 May 2024
    Release notes
    • Optimized IMap.update().
    Open source →
  9. 10.2.3 13 May 2024
    Release notes
    • Improved IList.zip() generic typing.
    Open source →
  10. 10.2.2 01 Apr 2024
    Release notes
    • You can now declare empty lists, sets and maps like this (https://github.com/marcglasberg/fast_immutable_collections/pull/74):

      const IList<String>.empty();
      const ISet<String>.empty();
      const IMap<String, int>.empty();
      
    • Better inference for sumBy returning zero (https://github.com/marcglasberg/fast_immutable_collections/pull/71).

    Open source →
  11. 10.2.1 22 Mar 2024

    Nothing published for this version

  12. 10.2.0 22 Mar 2024

    Nothing published for this version

  13. 10.1.2 08 Mar 2024
    Release notes
    • Fixed https://github.com/marcglasberg/fast_immutable_collections/pull/71
    Open source →
  14. 10.1.1 14 Feb 2024
    Release notes
    • Fixed https://github.com/marcglasberg/fast_immutable_collections/issues/69
    Open source →
  15. 10.1.0 28 Jan 2024
    Release notes
    • Fixed https://github.com/marcglasberg/fast_immutable_collections/issues/68
    Open source →
  16. 10.0.0 25 Jan 2024
    Release notes
    • Removed tuples in favor of records.
    Open source →
  17. 9.2.1 24 Jan 2024
    Release notes
    • @useResult annotation to signal that a method should return a copy of the collection, instead of mutating it.
    Open source →
  18. 9.2.0 10 Nov 2023

    Nothing published for this version

  19. 9.1.6 08 Oct 2023
    Release notes
    • Small docs improvement.
    Open source →
  20. 9.1.5 31 May 2023
    Release notes
    • Fixed type erasure in IMap.toJson and build issue for benchmark app.
    Open source →
  21. 9.1.3 29 May 2023

    Nothing published for this version

  22. 9.1.2 27 May 2023

    Nothing published for this version

  23. 9.1.1 27 Apr 2023
    Release notes
    • Function compareObject now also compares enums by their name.
    Open source →
  24. 9.1.0 26 Apr 2023

    Nothing published for this version

  25. 9.0.0 26 Feb 2023
    Release notes
    • Version bump of dependencies: collection: ^1.17.0, meta: ^1.8.0
    Open source →
  26. 8.2.0 30 Jan 2023
    Release notes
    • IList.replaceBy method lets you define a function to transform an item at a specific index location.
    Open source →
  27. 8.1.1 06 Jan 2023
    Release notes
    • IList.indexOf extension fix (doesn't break anymore when list is empty and start is zero).
    Open source →
  28. 8.1.0 27 Nov 2022
    Release notes
    • Iterable.intersectsWith extension.
    Open source →
  29. 8.0.0 27 Oct 2022
    Release notes
    • Breaking change: IList.replaceFirstWhere signature is now IList<T> replaceFirstWhere(bool Function(T item) test, T Function(T? item) replacement, {bool addIfNotFound = false}) instead of IList<T> replaceFirstWhere(bool Function(T item) test, T to, {bool addIfNotFound = false}) In case this change breaks your code, the fix is simple. Instead of something like ilist.replaceFirstWhere((String item) => item=="1", "2") do this: ilist.replaceFirstWhere((String item) => item=="1", (_) => "2")
    Open source →
  30. 7.4.3 05 Oct 2022

    Nothing published for this version

  31. 7.4.2 19 Sep 2022

    Nothing published for this version

  32. 7.4.1 22 May 2022

    Nothing published for this version

  33. 7.4.0 20 May 2022

    Nothing published for this version

  34. 7.3.1 16 Apr 2022

    Nothing published for this version

  35. 7.2.1 14 Mar 2022

    Nothing published for this version

  36. 7.2.0 06 Feb 2022

    Nothing published for this version

  37. 7.1.3 31 Jan 2022

    Nothing published for this version

  38. 7.1.2 23 Dec 2021

    Nothing published for this version

  39. 7.1.1 23 Dec 2021

    Nothing published for this version

  40. 7.1.0 23 Dec 2021

    Nothing published for this version

  41. 7.1.0-dev0 26 Nov 2021 pre-release

    Nothing published for this version

  42. 7.0.7-dev0 18 Oct 2021 pre-release

    Nothing published for this version

  43. 7.0.6-dev0 09 Oct 2021 pre-release

    Nothing published for this version

  44. 7.0.5-dev0 27 Sep 2021 pre-release

    Nothing published for this version

  45. 7.0.3 19 Sep 2021

    Nothing published for this version

  46. 7.0.2 17 Sep 2021

    Nothing published for this version

  47. 7.0.1 17 Sep 2021

    Nothing published for this version

  48. 7.0.0 12 Sep 2021

    Nothing published for this version

  49. 6.0.0 05 Sep 2021

    Nothing published for this version

  50. 5.1.3 01 Sep 2021

    Nothing published for this version

  51. 5.1.2 19 Jul 2021

    Nothing published for this version

  52. 5.1.1 16 Jul 2021

    Nothing published for this version

  53. 5.0.5 27 Jun 2021

    Nothing published for this version

  54. 5.0.4 24 Jun 2021

    Nothing published for this version

  55. 5.0.3 24 Jun 2021

    Nothing published for this version

  56. 5.0.2 23 Jun 2021

    Nothing published for this version

  57. 5.0.1 07 Jun 2021

    Nothing published for this version

  58. 5.0.0 24 May 2021

    Nothing published for this version

  59. 5.0.0-dev.13 11 May 2021 pre-release

    Nothing published for this version

  60. 5.0.0-dev.12 06 May 2021 pre-release

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive