Skip to content

Commit 3804a6c

Browse files
committed
Fix docs
1 parent b1cbd10 commit 3804a6c

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

dartx/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.1.2
2+
- Fixed docs
3+
- `'string'.reversed` now correctly handles grapheme clusters
4+
- **Breaking:** `'string'.chars` now returns the grapheme clusters instead of `Rune`s
5+
16
## 0.1.1
27
- Bugfixes
38
- More tests

dartx/README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var slice = [1, 2, 3, 4, 5].slice(1, -2); // [2, 3]
3131
## Iterable
3232

3333
### slice()
34-
Returns elements at indices between `start` (inclusive) and `end` (inclusive)
34+
Returns elements at indices between `start` (inclusive) and `end` (inclusive).
3535
```dart
3636
var list = [0, 1, 2, 3, 4, 5]);
3737
var last = list.slice(-1); // [5]
@@ -40,7 +40,7 @@ var allButFirstAndLast = list.slice(1, -2); // [1, 2, 3, 4]
4040
```
4141

4242
### sortedBy() & thenBy()
43-
Sort lists by multiple properties
43+
Sort lists by multiple properties.
4444
```dart
4545
var dogs = [
4646
Dog(name: "Tom", age: 3),
@@ -57,7 +57,7 @@ var sorted = dogs
5757
```
5858

5959
### distinctBy()
60-
Get distinct elements from a list:
60+
Get distinct elements from a list.
6161
```dart
6262
var list = ['this', 'is', 'a', 'test'];
6363
var distinctByLength = list.distinctBy((it) => it.length); // ['this', 'is', 'a']
@@ -73,9 +73,9 @@ var flattened = nestedList.flatten(); // [1, 2, 3, 4, 5, 6]
7373
## String
7474

7575
### chars
76-
Get a list of single character strings from a string.
76+
Get a list of single character strings from a string. Supports emojis.
7777
```dart
78-
var chars = 'test'.chars; // ['t', 'e', 's', 't']
78+
var chars = 'family👨‍👨‍👧‍👦'.chars; // ['f', 'a', 'm', 'i', 'l', 'y', '👨‍👨‍👧‍👦']
7979
```
8080

8181
### isBlank()
@@ -95,7 +95,7 @@ var notANumber = '123-45'.toIntOrNull(); // null
9595
## File
9696

9797
### name
98-
Get the name and extension of a file:
98+
Get the name and extension of a file.
9999
```dart
100100
var file = File('some/path/testFile.dart');
101101
print(file.name); // 'testFile.dart'
@@ -109,7 +109,7 @@ await File('someFile.json').appendText('{test: true}');
109109
```
110110

111111
### isWithin()
112-
Checks if a file is inside a directory
112+
Checks if a file is inside a directory.
113113
```dart
114114
var dir = Directory('some/path');
115115
File('some/path/file.dart').isWithin(dir); // true

dartx/lib/src/io/directory.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ extension DirectoryX on Directory {
1313
);
1414
}
1515

16-
/// Copies all of the files in the [from] directory to [to].
16+
/// Copies all of the files in this directory to [target].
1717
///
1818
/// This is similar to `cp -R <from> <to>`:
1919
/// * Symlinks are supported.
2020
/// * Existing files are over-written, if any.
21-
/// * If [to] is within [from], throws [ArgumentError] (an infinite operation).
22-
/// * If [from] and [to] are canonically the same, no operation occurs.
21+
/// * If [target] is within `this`, throws [ArgumentError].
22+
/// * If `this` and [target] are canonically the same, no operation occurs.
2323
///
2424
/// Returns a future that completes when complete.
2525
Future<Null> copyRecursively(Directory target) async {

dartx/lib/src/io/file.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ extension FileX on File {
1010

1111
/// Appends a [string] to the content of this file using UTF-8 or the
1212
/// specified [encoding].
13-
Future<void> appendString(String string, {Encoding encoding: utf8}) async {
13+
Future<void> appendString(String string, {Encoding encoding = utf8}) async {
1414
var raf = await open(mode: FileMode.writeOnlyAppend);
1515
await raf.writeString(string);
1616
await raf.close();

dartx/lib/src/list.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ extension ListX<E> on List<E> {
130130
///
131131
/// This insertion sort is stable: Equal elements end up in the same order
132132
/// as they started in.
133-
void insertionSort({Comparator<E> comparator, int start: 0, int end}) {
133+
void insertionSort({Comparator<E> comparator, int start = 0, int end}) {
134134
_insertionSort(this, compare: comparator, start: start, end: end);
135135
}
136136

@@ -150,7 +150,7 @@ extension ListX<E> on List<E> {
150150
///
151151
/// This merge sort is stable: Equal elements end up in the same order
152152
/// as they started in.
153-
void mergeSort({int start: 0, int end, Comparator<E> comparator}) {
153+
void mergeSort({int start = 0, int end, Comparator<E> comparator}) {
154154
_mergeSort(this, start: start, end: end, compare: comparator);
155155
}
156156
}

0 commit comments

Comments
 (0)