Skip to content

Commit

Permalink
Doc improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcglasberg committed Nov 28, 2024
1 parent 0c03e74 commit 620660c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,9 @@ The `replaceBy` method lets you define a function to transform an item at a spec

It's actually possible to create a const `IList`, but you must follow these rules:

1. Instantiate an `IListConst` (or use `IListConst.empty()`).
1. Instantiate an `IListConst` (or use `IList.empty()`).
2. Explicitly assign it to an `IList`.
3. Use the const keyword.
3. Use the `const` keyword.

Examples:

Expand All @@ -431,21 +431,21 @@ So, for example, those are wrong:

```
// Wrong: Not using the const keyword.
IList<int> ilist = IListConst([]);
IList<int> ilist = IList.empty();
IList<int> ilist = IListConst([]);
// Wrong: Not explicitly assigning it to an `IList`.
const ilist = IListConst([]);
```

One other thing to keep in mind is that the `IListConst()` constructor always uses
`ConfigList(isDeepEquals: true, cacheHashCode: true)`, completely ignoring the global
`defaultConfig` (which will be explained below). This means if you want a specific a config you must
provide it in the constructor.
`defaultConfig` (which will be explained below). This means if you want a specific a
config you must provide it in the constructor.

_Note: While the FIC collections are generally intuitive to use, the **const** `IList` is a bit
cumbersome to use, because of these rules you have to remember. Unfortunately it can't be avoided
because of the limitations of the Dart language._
_Note: While the FIC collections are generally intuitive to use, the **const** `IList`
is a bit cumbersome to use, because of these rules you have to remember.
Unfortunately it can't be avoided because of the limitations of the Dart language._

## 2.1. IList Equality

Expand Down
2 changes: 1 addition & 1 deletion lib/src/base/iterable_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ extension FicIterableExtension<T> on Iterable<T> {
/// (and the [id] is a function of the item), like so:
///
/// 1) Items with the same [id] will be replaced, in place.
/// 2) Items with new [id]s will be added go to the end of the list.
/// 2) Items with new [id]s will be added to the end of the list.
///
/// Note: If the original iterable contains more than one item with the
/// same [id] as some item in [newItems], the first will be replaced, and
Expand Down
2 changes: 1 addition & 1 deletion lib/src/ilist/ilist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ abstract class IList<T> // ignore: must_be_immutable
/// (and the [id] is a function of the item), like so:
///
/// 1) Items with the same [id] will be replaced, in place.
/// 2) Items with new [id]s will be added go to the end of the list.
/// 2) Items with new [id]s will be added to the end of the list.
///
/// Note: If the original list contains more than one item with the same
/// [id] as some item in [newItems], the first will be replaced, and the
Expand Down

0 comments on commit 620660c

Please sign in to comment.