Skip to content

Commit f72f5d6

Browse files
committed
More final, more nodoc, more good.
1 parent 9a13cec commit f72f5d6

10 files changed

+16
-11
lines changed

pkgs/collection/lib/src/combined_wrappers/combined_list.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import 'combined_iterator.dart';
1515
///
1616
/// The index operator (`[]`) and [length] property of a [CombinedListView] are
1717
/// both `O(lists)` rather than `O(1)`. A [CombinedListView] is unmodifiable.
18-
class CombinedListView<T> extends ListBase<T>
18+
final class CombinedListView<T> extends ListBase<T>
1919
implements UnmodifiableListView<T> {
2020
static Never _throw() {
2121
throw UnsupportedError('Cannot modify an unmodifiable List');

pkgs/collection/lib/src/combined_wrappers/combined_map.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import 'combined_iterable.dart';
1919
///
2020
/// The `length` getter is `O(M)` where M is the total number of entries in
2121
/// all maps, since it has to remove duplicate entries.
22-
class CombinedMapView<K, V> extends UnmodifiableMapBase<K, V> {
22+
final class CombinedMapView<K, V> extends UnmodifiableMapBase<K, V> {
2323
final Iterable<Map<K, V>> _maps;
2424

2525
/// Create a new combined view of multiple maps.

pkgs/collection/lib/src/empty_unmodifiable_set.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'unmodifiable_wrappers.dart';
88
import 'wrappers.dart';
99

1010
/// An unmodifiable, empty set which can be constant.
11-
class EmptyUnmodifiableSet<E> extends IterableBase<E>
11+
final class EmptyUnmodifiableSet<E> extends IterableBase<E>
1212
with UnmodifiableSetMixin<E>
1313
implements UnmodifiableSetView<E> {
1414
const EmptyUnmodifiableSet();

pkgs/collection/lib/src/equality_map.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'equality.dart';
88
import 'wrappers.dart';
99

1010
/// A [Map] whose key equality is determined by an [Equality] object.
11-
class EqualityMap<K, V> extends DelegatingMap<K, V> {
11+
final class EqualityMap<K, V> extends DelegatingMap<K, V> {
1212
/// Creates a map with equality based on [equality].
1313
EqualityMap(Equality<K> equality)
1414
: super(LinkedHashMap(

pkgs/collection/lib/src/equality_set.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'equality.dart';
88
import 'wrappers.dart';
99

1010
/// A [Set] whose key equality is determined by an [Equality] object.
11-
class EqualitySet<E> extends DelegatingSet<E> {
11+
final class EqualitySet<E> extends DelegatingSet<E> {
1212
/// Creates a set with equality based on [equality].
1313
EqualitySet(Equality<E> equality)
1414
: super(LinkedHashSet(

pkgs/collection/lib/src/iterable_extensions.dart

+3
Original file line numberDiff line numberDiff line change
@@ -604,13 +604,16 @@ extension IterableExtension<T> on Iterable<T> {
604604
}
605605

606606
/// Extensions that apply to iterables with a nullable element type.
607+
/// @nodoc
608+
@Deprecated('Use .nonNulls instead.')
607609
extension IterableNullableExtension<T extends Object> on Iterable<T?> {
608610
/// The non-`null` elements of this `Iterable`.
609611
///
610612
/// Returns an iterable which emits all the non-`null` elements
611613
/// of this iterable, in their original iteration order.
612614
///
613615
/// For an `Iterable<X?>`, this method is equivalent to `.whereType<X>()`.
616+
/// @nodoc
614617
@Deprecated('Use .nonNulls instead.')
615618
Iterable<T> whereNotNull() sync* {
616619
for (var element in this) {

pkgs/collection/lib/src/iterable_zip.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import 'dart:collection';
1313
/// combined into a single list, which becomes the next value of this
1414
/// [Iterable]'s [Iterator]. As soon as any of the iterators run out,
1515
/// the zipped iterator also stops.
16+
/// @nodoc
1617
@Deprecated('Use [i1, i2].zip from dart:collection')
17-
class IterableZip<T> extends IterableBase<List<T>> {
18+
final class IterableZip<T> extends IterableBase<List<T>> {
1819
final Iterable<Iterable<T>> _iterables;
1920

2021
IterableZip(Iterable<Iterable<T>> iterables) : _iterables = iterables;
@@ -28,7 +29,7 @@ class IterableZip<T> extends IterableBase<List<T>> {
2829
}
2930
}
3031

31-
class _IteratorZip<T> implements Iterator<List<T>> {
32+
final class _IteratorZip<T> implements Iterator<List<T>> {
3233
final List<Iterator<T>> _iterators;
3334
List<T>? _current;
3435

pkgs/collection/lib/src/union_set.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import 'unmodifiable_wrappers.dart';
1313
/// If an element is in multiple sets and the outer set is ordered, the version
1414
/// in the earliest inner set is preferred. Component sets are assumed to use
1515
/// `==` and `hashCode` for equality.
16-
class UnionSet<E> extends SetBase<E> with UnmodifiableSetMixin<E> {
16+
final class UnionSet<E> extends SetBase<E> with UnmodifiableSetMixin<E> {
1717
/// The set of sets that this provides a view of.
1818
final Set<Set<E>> _sets;
1919

pkgs/collection/lib/src/wrappers.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ class DelegatingMap<K, V> implements Map<K, V> {
503503
/// getter only shows an [Iterable] view of the keys.
504504
///
505505
/// Note that [lookup] is not supported for this set.
506-
class MapKeySet<E> extends _DelegatingIterableBase<E>
506+
final class MapKeySet<E> extends _DelegatingIterableBase<E>
507507
with UnmodifiableSetMixin<E> {
508508
final Map<E, dynamic> _baseMap;
509509

@@ -597,7 +597,8 @@ class MapKeySet<E> extends _DelegatingIterableBase<E>
597597
/// `recordSet.add(databaseRecord)` and `recordMap[id]`.
598598
///
599599
/// Effectively, the map will act as a kind of index for the set.
600-
class MapValueSet<K, V> extends _DelegatingIterableBase<V> implements Set<V> {
600+
final class MapValueSet<K, V> extends _DelegatingIterableBase<V>
601+
implements Set<V> {
601602
final Map<K, V> _baseMap;
602603
final K Function(V) _keyForValue;
603604

pkgs/collection/test/extensions_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2225,7 +2225,7 @@ Iterable<T> iterable<T>(Iterable<T> values) sync* {
22252225
yield* values;
22262226
}
22272227

2228-
Never unreachable([Object? _, Object? _, Object? _]) => fail('Unreachable');
2228+
Never unreachable([Object? _, Object? __, Object? ___]) => fail('Unreachable');
22292229

22302230
String toString(Object? o) => '$o';
22312231

0 commit comments

Comments
 (0)