Skip to content

Commit

Permalink
Fix documentation issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
renggli committed Aug 20, 2023
1 parent 2446451 commit bc42a2b
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 60 deletions.
4 changes: 2 additions & 2 deletions lib/src/collection/iterable/chunked.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extension ChunkedIterableExtension<E> on Iterable<E> {
/// Divides this [Iterable] into sub-lists of a given `size`. The final list
/// might be smaller or equal to the desired size.
///
/// The following expression yields [1, 2], [3, 4], [5]:
/// The following expression yields `[1, 2]`, `[3, 4]`, and `[5]`:
///
/// [1, 2, 3, 4, 5].chunked(2);
///
Expand All @@ -20,7 +20,7 @@ extension ChunkedIterableExtension<E> on Iterable<E> {
/// Divides this [Iterable] into sub-lists of a given `size`. The final list
/// is expanded with the provided `padding`, or `null`.
///
/// The following expression yields [1, 2], [3, 4], [5, -1]:
/// The following expression yields `[1, 2]`, `[3, 4]`, and `[5, -1]`:
///
/// [1, 2, 3, 4, 5].chunkedWithPadding(2, -1);
///
Expand Down
8 changes: 4 additions & 4 deletions lib/src/collection/iterable/flatten.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ extension FlattenIterableExtension<E> on Iterable<Iterable<E>> {
///
/// For example:
///
/// final input = [[1, 2], [3, 4]];
/// print(input.flatten()); // [1, 2, 3, 4]
/// final input = [[1, 2], [3, 4]];
/// print(input.flatten()); // [1, 2, 3, 4]
///
Iterable<E> flatten() => expand((values) => values);
}
Expand All @@ -15,8 +15,8 @@ extension DeepFlattenIterableExtension on Iterable<dynamic> {
///
/// For example:
///
/// final input = [1, 2, [3, 4, [5, 6]]];
/// print(input.deepFlatten()); // [1, 2, 3, 4, 5, 6]
/// final input = [1, 2, [3, 4, [5, 6]]];
/// print(input.deepFlatten()); // [1, 2, 3, 4, 5, 6]
///
Iterable<E> deepFlatten<E>() sync* {
for (var value in this) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/collection/iterable/iterate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'dart:collection' show IterableBase;

import 'mixins/infinite.dart';

/// Returns a lazy infinite list of repeated applications of the [function] to
/// the initial [value].
/// Returns a lazy infinite list of repeated applications of [callback] to the
/// initial [value].
///
/// For example, the expression
///
Expand Down
8 changes: 4 additions & 4 deletions lib/src/collection/iterable/operators.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extension OperatorsIterableExtension<E> on Iterable<E> {
///
/// For example
///
/// [3, 1, 2].min()
/// [3, 1, 2].min()
///
/// returns `1`.
///
Expand All @@ -22,7 +22,7 @@ extension OperatorsIterableExtension<E> on Iterable<E> {
///
/// For example
///
/// [3, 1, 2].smallest(2)
/// [3, 1, 2].smallest(2)
///
/// returns `[1, 2]`.
///
Expand All @@ -37,7 +37,7 @@ extension OperatorsIterableExtension<E> on Iterable<E> {
///
/// For example
///
/// [3, 1, 2].max()
/// [3, 1, 2].max()
///
/// returns `3`.
///
Expand All @@ -50,7 +50,7 @@ extension OperatorsIterableExtension<E> on Iterable<E> {
///
/// For example
///
/// [3, 1, 2].largest(2)
/// [3, 1, 2].largest(2)
///
/// returns `[3, 2]`.
///
Expand Down
16 changes: 8 additions & 8 deletions lib/src/collection/iterable/power_set.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ extension PowerSetIterableExtension<E> on Iterable<E> {
///
/// For example `['x', 'y', 'z'].powerSet()` yields the following sets:
///
/// []
/// ['x']
/// ['y']
/// ['z']
/// ['x', 'y']
/// ['x', 'z']
/// ['y', 'z']
/// ['x', 'y', 'z']
/// []
/// ['x']
/// ['y']
/// ['z']
/// ['x', 'y']
/// ['x', 'z']
/// ['y', 'z']
/// ['x', 'y', 'z']
///
Iterable<List<E>> powerSet() sync* {
final list = toList(growable: false);
Expand Down
28 changes: 14 additions & 14 deletions lib/src/collection/iterable/product.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ extension ProductIterableExtension<E> on Iterable<Iterable<E>> {
///
/// For example, the product of `['x', 'y']` and `[1, 2, 3]` is created with
///
/// [['x', 'y'], [1, 2, 3]].product();
/// [['x', 'y'], [1, 2, 3]].product();
///
/// and results in an iterable with the following elements:
///
/// ['x', 1]
/// ['x', 2]
/// ['x', 3]
/// ['y', 1]
/// ['y', 2]
/// ['y', 3]
/// ['x', 1]
/// ['x', 2]
/// ['x', 3]
/// ['y', 1]
/// ['y', 2]
/// ['y', 3]
///
Iterable<List<E>> product({int repeat = 1}) {
checkNonZeroPositive(repeat, 'repeat');
Expand All @@ -40,16 +40,16 @@ extension Product2IterableExtension<T1, T2> on (Iterable<T1>, Iterable<T2>) {
///
/// For example, the product of `['x', 'y']` and `[1, 2, 3]` is created with
///
/// (['x', 'y'], [1, 2, 3]).product();
/// (['x', 'y'], [1, 2, 3]).product();
///
/// and results in an iterable with the following tuples:
///
/// ('x', 1)
/// ('x', 2)
/// ('x', 3)
/// ('y', 1)
/// ('y', 2)
/// ('y', 3)
/// ('x', 1)
/// ('x', 2)
/// ('x', 3)
/// ('y', 1)
/// ('y', 2)
/// ('y', 3)
///
Iterable<(T1, T2)> product() sync* {
for (final v1 in $1) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/collection/iterable/random.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extension RandomIterableExtension<E> on Iterable<E> {
///
/// For example
///
/// [1, 2, 3, 4, 5, 6].atRandom()
/// [1, 2, 3, 4, 5, 6].atRandom()
///
/// returns a random dice roll each time you call it.
///
Expand Down
4 changes: 2 additions & 2 deletions lib/src/collection/iterable/repeat_iterable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ extension RepeatIterableExtension<E> on Iterable<E> {
///
/// Example expressions:
///
/// [1, 2].repeat(); // [1, 2, 1, 2, ...]
/// [1, 2, 3].repeat(count: 2); // [1, 2, 3, 1, 2, 3]
/// [1, 2].repeat(); // [1, 2, 1, 2, ...]
/// [1, 2, 3].repeat(count: 2); // [1, 2, 3, 1, 2, 3]
///
Iterable<E> repeat({int? count}) {
if (count == 0 || isEmpty) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/collection/iterable/separated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ extension SeparatedIterableExtension<E> on Iterable<E> {
///
/// Examples:
///
/// [1, 2, 3].separatedBy(() => 0); // [1, 0, 2, 0, 3]
/// [1, 2].separateBy(() => 0, after: () => -1); // [1, 0, 2, -1]
/// [1, 2, 3].separatedBy(() => 0); // [1, 0, 2, 0, 3]
/// [1, 2].separateBy(() => 0, after: () => -1); // [1, 0, 2, -1]
///
Iterable<E> separatedBy(Builder<E> separator,
{Builder<E>? before, Builder<E>? after}) sync* {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/collection/iterable/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../../shared/exceptions.dart';
extension WindowIterableExtension<E> on Iterable<E> {
/// Sliding window of given `size` over this [Iterable].
///
/// The following expression yields [1, 2, 3], [2, 3, 4], [3, 4, 5]:
/// The following expression yields `[1, 2, 3]`, `[2, 3, 4]`, and `[3, 4, 5]`:
///
/// [1, 2, 3, 4, 5].window(3);
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/collection/iterable/zip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extension ZipIterableExtension<E> on Iterable<Iterable<E>> {
/// new list. The resulting iterable has the length of the shortest input
/// iterable.
///
/// The following expression yields [1, 'a'], [2, 'b']:
/// The following expression yields `[1, 'a']` and `[2, 'b']`:
///
/// [[1, 2], ['a', 'b']].zip();
///
Expand Down
6 changes: 3 additions & 3 deletions lib/src/collection/map/default.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ extension DefaultMapExtension<K, V> on Map<K, V> {
///
/// For example:
///
/// final map = {'a': 1}.withDefault(42);
/// print(map['z']); // prints '42'
/// print(map.containsKey('z')); // prints 'false'
/// final map = {'a': 1}.withDefault(42);
/// print(map['z']); // prints '42'
/// print(map.containsKey('z')); // prints 'false'
///
MapWithDefault<K, V> withDefault(V value) => MapWithDefault(this, value);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/collection/range/bigint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import '../range.dart';
/// range essentially implements a lazy list that is also produced by the
/// following for-loop:
///
/// for (BigInt i = start; i < stop; i += step) {
/// ...
/// for (BigInt i = start; i < stop; i += step) {
/// ...
///
class BigIntRange extends Range<BigInt> {
/// Creates a virtual range of numbers containing an arithmetic progressions
Expand Down
4 changes: 2 additions & 2 deletions lib/src/collection/range/double.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import '../range.dart';
/// range essentially implements a lazy list that is also produced by the
/// following for-loop:
///
/// for (double i = start; i < stop; i += step) {
/// ...
/// for (double i = start; i < stop; i += step) {
/// ...
///
class DoubleRange extends Range<double> {
/// Creates a virtual range of numbers containing an arithmetic progressions
Expand Down
4 changes: 2 additions & 2 deletions lib/src/collection/range/integer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import '../range.dart';
/// range essentially implements a lazy list that is also produced by the
/// following for-loop:
///
/// for (int i = start; i < stop; i += step) {
/// ...
/// for (int i = start; i < stop; i += step) {
/// ...
///
class IntegerRange extends Range<int> {
/// Creates a virtual range of numbers containing an arithmetic progressions
Expand Down
2 changes: 1 addition & 1 deletion lib/src/graph/operations/map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../strategy.dart';
extension MapGraphExtension<V, E> on Graph<V, E> {
/// Creates a new graph by mapping vertices and edges to new values.
///
/// The optional `vertex` function maps vertices of type [V] to type [VE].
/// The optional `vertex` function maps vertices of type [V] to type [VR].
/// The optional `edge` function maps edges of type [E] to type [ER].
///
/// If no `vertex` and `edge` function is provided a copy of the current graph
Expand Down
8 changes: 4 additions & 4 deletions lib/src/printer/to_string.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import 'object/object.dart';
/// Add the mixin to the root of your object hierarchy and override the
/// `toStringPrinter` accessor:
///
/// @override
/// ObjectPrinter get toStringPrinter => super.toStringPrinter
/// ..addValue(someField, name: 'someField')
/// ..addValue(otherField, name: 'otherField');
/// @override
/// ObjectPrinter get toStringPrinter => super.toStringPrinter
/// ..addValue(someField, name: 'someField')
/// ..addValue(otherField, name: 'otherField');
///
/// Note: Due to the lack of a `Self` type in Dart, this is working with a
/// dynamically typed printer Object. To avoid loosing the type information
Expand Down
10 changes: 5 additions & 5 deletions lib/src/printer/where.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ import 'object/object.dart';
import 'printer.dart';

extension WherePrinterExtension<T> on Printer<T> {
/// Returns a printer that only prints the receiver if the [predicate]
/// Returns a printer that only prints the receiver if the [callback]
/// evaluates to `true`.
Printer<T> where(Predicate1<T> callback) => WherePrinter<T>(this, callback);
}

class WherePrinter<T> extends Printer<T> {
const WherePrinter(this.printer, this.predicate);
const WherePrinter(this.printer, this.callback);

final Printer<T> printer;
final Predicate1<T> predicate;
final Predicate1<T> callback;

@override
void printOn(T object, StringBuffer buffer) {
if (predicate(object)) {
if (callback(object)) {
printer.printOn(object, buffer);
}
}

@override
ObjectPrinter get toStringPrinter => super.toStringPrinter
..addValue(printer, name: 'printer')
..addValue(predicate, name: 'predicate');
..addValue(callback, name: 'callback');
}

0 comments on commit bc42a2b

Please sign in to comment.