- Added
Iterable.sumBy()
andIterable.averageBy()
extensions.
- Fixed
ListMap.forEach()
to return items in the correct order.
-
Note: You may get false positive warnings for some methods annotated with
@UseResult
. This is a Dart bug, which will be fixed in the future. It means nothing and you shouldn't pay attention to it. -
Doc improvements. Better hiding internal classes. Better code dividers.
- Added
IMap.mapTo()
method, andMap.mapTo()
extension.
- Improved JSON conversion: Added conversion of non-String keys for maps. This solves an issue where keys of maps are not converted to Strings. Strings are the only valid json map keys, so only primitive types or types convertible to a String can be keys if using json serialization. Unfortunately, the current workaround is limited in what types can be supported, but hopefully the underlying issue with json_serializable can be fixed, which would solve this in general.
- Added @UseResult annotation to signal that mutated copies should not be discarded.
- Extension
List.mapIndexedAndLast()
.
-
Const
IMap
. Example:const IMap<String, int> myMap = IMapConst({1:'a', 2:'b'});
Example of const empty map:const IMap<String, int> myMap = IMapConst({});
-
Const
IMapOfSets
. Example:const IMapOfSets<String, int> myMapOfSets = IMapOfSetsConst(IMapConst({}));
Example of const empty map of sets:const IMapOfSets<String, int> myMapOfSets = IMapOfSetsConst(IMapConst({'a': ISetConst({1, 2})}));
-
Breaking change: If you use the
IListConst.withConfig()
orISetConst.withConfig()
constructors, just remove the.withConfig
and it will work. For example:IListConst.withConfig([], ConfigList(isDeepEquals: false))
should becomeIListConst([], ConfigList(isDeepEquals: false))
.
- Breaking change: Note, unless you know what an "async flush mode" is, and use it explicitly, this
breaking change is not important to you, and you don't need to do anything to upgrade. If you want
to know the details, however, keep reading. I have removed the async flush mode. The
async flush mode only flushed after the async gap, but since Dart does not allow
tail-call-optimization (dart-lang/language#1159) it was not possible
to guarantee that very large collections created within the current microtask would not throw a
stack-overflow error when reading values from it. The solution to make it work async was to
tail-call-optimize by hand, which I played with a little. For example, check out the new
IMap
implementations foroperator []
andcontainsKey()
. However, I'd actually have to do that for each and every method that traverses the data tree, for each collection in FIC. The amount of work was just too much, so I've decided to remove the async flush mode. The sync mode was recommended anyway (which now is the only mode, meaning I have removed any references to it in the docs), so I guess that won't make much of a difference to anyone.
FromIListMixin
andFromISetMixin
improvement to deal withIListConst<Never>
.
IList.sortReversed()
.
ListMap.unsafeFrom()
constructor.
-
Breaking change: Align head and tail to dart convention as getter like first and last
-
Introduce the OP typedef.
-
IList.init
Access init part of the list. -
IList.inits
,IList.tails
methods. -
IList.splitAt
Tuples from original list at specified index. -
IList.whereNot
Reverse predicate for Where. -
Iterable<Tuple2<U, V>>.unzip()
extension. -
IList.count(Predicate)
count positive predicates. -
IList.iterate
generate IList applying OP multiple times. -
IList.iterateWhile
generate IList applying OP while Predicate stand. -
IList.span
Tuple2 will contain the longest consecutive positive predicate then the rest of the list. -
IList.tabulate
Apply function start at 0 on multiples dimensions. -
IList.corresponds
Check for correspondence between list and applied function on list. -
IList.lengthCompare
ISet.lengthCompare
Direct size comparison as convenience for composition. -
Arity property on Abstract Tuple.
- MapOfSets.isEmptyForKey() and MapOfSets.isNotEmptyForKey().
- Introduce the Predicate typedef.
List.sortReversed()
extension.
-
Iterable.restrict()
restricts some item to one of those present in this iterable. -
Reuse
IList
s andISet
s only if they have the exact same generic type.
-
Const
IList
. Example:const IList<int> myList = IListConst([1, 2, 3]);
Example of const empty list:const IList<String> myList = IListConst([]);
-
Const
ISet
. Example:const ISet<int> mySet = ISetConst({1, 2, 3});
Example of const empty set:const ISet<String> mySet = ISetConst({});
-
Methods
IList.get()
,IList.getOrNull()
andIList.getAndMap()
. -
Extensions
List.get()
,List.getOrNull()
andList.getAndMap()
. -
Better NNBD for
divideListAsMap()
andsortedLike()
. -
Better Json serialization for NNBD.
-
Small IMapOfSets.fromIterable() improvement: added
ignore
parameter. -
Breaking change: Removed
empty()
constructors fromIList
andISet
. You can create empty collections usingIList()
andISet()
, ormyIList.clear()
andmyISet.clear()
, orIList.withConfig(const [], myConfig)
andISet.withConfig(const [], myConfig)
, orconst IListConst([])
andconst ISetConst({})
. -
Breaking change: Removed all extensions like
isNullOrEmpty
and similar. This was a good idea before NNBD, but now if you use this Dart can't infer nullability anymore. -
Breaking change. Please, add
import "package:collection/collection.dart";
to your project. I have removed a few methods, likeIterable.mapIndexed
, because they are now present in thecollection
package.
- Extension
List.withNullsRemoved()
.
- The
contains()
methods now acceptnull
. - Method
toggle()
now returns the correct bool.
Iterable.isFirst
,isNotFirst
,isLast
andisNotLast
.
-
Breaking change. Please, add
import "package:collection/collection.dart";
to your project. I have removed the following methods because they are now present in thecollection
package:Iterable.firstwhereOrNull
Iterable.whereNotNull
-
Breaking change:
inRange()
of nullable num now returns non-null, andorElse
is not optional. -
Added
Iterable.mapNotNull
extension. It's similar tomap
, but returnsIterable<T>
, whereT
can be a non-nullable type. This is equivalent tomap
pluscast
, but has a better name when you are just using it to solve NNBD problems.
-
Json serialization support for json_serializable with @JsonSerializable (for IList, ISet, IMap, ListSet, ListSetView).
-
Renamed extension
isNotNullOrZero
toisNotNullNotZero
.
- Factories
IList<T>.orNull()
,ISet<T>.orNull()
,IMap<K, V>.orNull()
, andIMapofSets<K, V>.orNull()
, that help implementcopyWith
methods.
- Breaking changes:
Iterable.removeDuplicates
was renamed toIterable.whereNoDuplicates
to indicate it returns an Iterable.Iterable.removeNulls
was renamed toIterable.whereNotNull
to indicate it returns an Iterable.List.removeNulls
now is a List extension only. It mutates theList
, removing nulls.List.removeDuplicates
now is a List extension only. It mutates theList
, removing all duplicates.Set.removeNulls
now is a Set extension only. It mutates theSet
, removing all nulls.
- Nullsafety improvements.
- isNotNullOrEmpty getter renamed to isNotNullNotEmpty.
- isEmptyButNotNull getter to isEmptyNotNull.
- More efficient Iterable.sortedLike() and List.sortLike() extensions.
- Set.diffAndIntersect(), Iterable.everyIs() and Iterable.anyIs() extensions.
- Better generics compatibility for
equalItemsAndConfig
.
IList.replace()
.ISet.difference()
,intersection
,union
now accept iterables.
areSameImmutableCollection()
andareImmutableCollectionsWithEqualItems()
functions.
- Initial version.