Revert the additional changes.
diff --git a/lib/tuple.dart b/lib/tuple.dart
index bf874e1..5321f7c 100644
--- a/lib/tuple.dart
+++ b/lib/tuple.dart
@@ -22,7 +22,6 @@
/// ```
library tuple;
-import 'package:quiver/check.dart';
import 'package:quiver/core.dart';
/// Represents a 2-tuple, or pair.
@@ -38,10 +37,10 @@
/// Create a new tuple value with the specified list [items].
factory Tuple2.fromList(List items) {
- checkArgument(
- identical(items?.length, 2),
- message: 'items must have two values',
- );
+ if (items.length != 2) {
+ throw ArgumentError('items must have length 2');
+ }
+
return Tuple2<T1, T2>(items[0] as T1, items[1] as T2);
}
@@ -67,7 +66,7 @@
@override
bool operator ==(other) =>
- other is Tuple2<T1, T2> && other.item1 == item1 && other.item2 == item2;
+ other is Tuple2 && other.item1 == item1 && other.item2 == item2;
@override
int get hashCode => hash2(item1.hashCode, item2.hashCode);
@@ -89,8 +88,10 @@
/// Create a new tuple value with the specified list [items].
factory Tuple3.fromList(List items) {
- checkArgument(identical(items?.length, 3),
- message: 'items must have three values');
+ if (items.length != 3) {
+ throw ArgumentError('items must have length 3');
+ }
+
return Tuple3<T1, T2, T3>(items[0] as T1, items[1] as T2, items[2] as T3);
}
@@ -121,7 +122,7 @@
@override
bool operator ==(other) =>
- other is Tuple3<T1, T2, T3> &&
+ other is Tuple3 &&
other.item1 == item1 &&
other.item2 == item2 &&
other.item3 == item3;
@@ -149,8 +150,10 @@
/// Create a new tuple value with the specified list [items].
factory Tuple4.fromList(List items) {
- checkArgument(identical(items?.length, 4),
- message: 'items must have four values');
+ if (items.length != 4) {
+ throw ArgumentError('items must have length 4');
+ }
+
return Tuple4<T1, T2, T3, T4>(
items[0] as T1, items[1] as T2, items[2] as T3, items[3] as T4);
}
@@ -187,7 +190,7 @@
@override
bool operator ==(other) =>
- other is Tuple4<T1, T2, T3, T4> &&
+ other is Tuple4 &&
other.item1 == item1 &&
other.item2 == item2 &&
other.item3 == item3 &&
@@ -220,10 +223,10 @@
/// Create a new tuple value with the specified list [items].
factory Tuple5.fromList(List items) {
- checkArgument(
- identical(items?.length, 5),
- message: 'items must have five values',
- );
+ if (items.length != 5) {
+ throw ArgumentError('items must have length 5');
+ }
+
return Tuple5<T1, T2, T3, T4, T5>(items[0] as T1, items[1] as T2,
items[2] as T3, items[3] as T4, items[4] as T5);
}
@@ -265,7 +268,7 @@
@override
bool operator ==(other) =>
- other is Tuple5<T1, T2, T3, T4, T5> &&
+ other is Tuple5 &&
other.item1 == item1 &&
other.item2 == item2 &&
other.item3 == item3 &&
@@ -308,10 +311,10 @@
/// Create a new tuple value with the specified list [items].
factory Tuple6.fromList(List items) {
- checkArgument(
- identical(items?.length, 6),
- message: 'items must have six values',
- );
+ if (items.length != 6) {
+ throw ArgumentError('items must have length 6');
+ }
+
return Tuple6<T1, T2, T3, T4, T5, T6>(items[0] as T1, items[1] as T2,
items[2] as T3, items[3] as T4, items[4] as T5, items[5] as T6);
}
@@ -358,7 +361,7 @@
@override
bool operator ==(other) =>
- other is Tuple6<T1, T2, T3, T4, T5, T6> &&
+ other is Tuple6 &&
other.item1 == item1 &&
other.item2 == item2 &&
other.item3 == item3 &&
@@ -406,10 +409,10 @@
/// Create a new tuple value with the specified list [items].
factory Tuple7.fromList(List items) {
- checkArgument(
- identical(items?.length, 7),
- message: 'items must have seven values',
- );
+ if (items.length != 7) {
+ throw ArgumentError('items must have length 7');
+ }
+
return Tuple7<T1, T2, T3, T4, T5, T6, T7>(
items[0] as T1,
items[1] as T2,
@@ -476,7 +479,7 @@
@override
bool operator ==(other) =>
- other is Tuple7<T1, T2, T3, T4, T5, T6, T7> &&
+ other is Tuple7 &&
other.item1 == item1 &&
other.item2 == item2 &&
other.item3 == item3 &&
diff --git a/test/tuple_test.dart b/test/tuple_test.dart
index fc0de80..657451d 100644
--- a/test/tuple_test.dart
+++ b/test/tuple_test.dart
@@ -16,7 +16,7 @@
group('\'s fromList', () {
test('throws when items is null', () {
- expect(() => Tuple2<int, String>.fromList(null), throwsArgumentError);
+ expect(() => Tuple2<int, String>.fromList(null), throwsA(anything));
});
test('throws when items is empty', () {
@@ -110,7 +110,7 @@
group('\'s fromList', () {
test('throws when items is null', () {
expect(
- () => Tuple3<int, String, int>.fromList(null), throwsArgumentError);
+ () => Tuple3<int, String, int>.fromList(null), throwsA(anything));
});
test('throws when items is empty', () {
@@ -222,7 +222,7 @@
group('\'s fromList', () {
test('throws when items is null', () {
expect(() => Tuple4<int, String, int, String>.fromList(null),
- throwsArgumentError);
+ throwsA(anything));
});
test('throws when items is empty', () {
@@ -360,7 +360,7 @@
group('\'s fromList', () {
test('throws when items is null', () {
expect(() => Tuple5<int, String, int, String, int>.fromList(null),
- throwsArgumentError);
+ throwsA(anything));
});
test('throws when items is empty', () {
@@ -534,7 +534,7 @@
test('throws when items is null', () {
expect(
() => Tuple6<int, String, int, String, int, String>.fromList(null),
- throwsArgumentError);
+ throwsA(anything));
});
test('throws when items is empty', () {
@@ -754,7 +754,7 @@
expect(
() => Tuple7<int, String, int, String, int, String, int>.fromList(
null),
- throwsArgumentError);
+ throwsA(anything));
});
test('throws when items is empty', () {