recollection 1.0.0 copy "recollection: ^1.0.0" to clipboard
recollection: ^1.0.0 copied to clipboard

Effective immutable collections for Dart.

Recollection #

Effective immutable collections for Dart.

API docs

Examples #

Create immutable views around list with ListView. Recreate lists with ListBuilder.

var list = [1, 2, 3];

var view = ListView.of(list);

list = ListBuilder.from(list)
  .add(4)
  .remove(2)
  .build();

Same is possible with sets and maps.

Justification #

SDK immutable collection constructors, like List.unmodifiable, copy whole collection using Iterator, which is slow and inefficient.

built_collection package contains immutable wrappers around SDK collections, however there is no way to create immutable wrapper around existing collection without recreating collection from scratch.

recollection package contains immutable collection wrappers that do not copy source collection by themselves. Also there are builders that can be used to create a copy of existing SDK collection with some changes. Those are valuable benefits for performance-sensitive scenarios.

0
likes
20
pub points
0%
popularity

Publisher

verified publisherwrike.com

Effective immutable collections for Dart.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

meta

More

Packages that depend on recollection