Another place where generic methods would be nice IMO is dart:unittest:
void expect<T>(T item, Matcher<T>);
Matcher<num> closeTo(num value, num delta);
Matcher<Map<K, V>> containsPair<K, V>(K key, V value);
Matcher<Map<Dynamic, V>> containsValue<V>(V value);
Matcher<Map<K, Dynamic>> containsKey<K>(K key);
Matcher<String> startsWith(String str);
Matcher<String> endsWith(String str);
Matcher<String> matches(Pattern pattern);
Matcher<String> equalsIgnoringCase(String str);
Matcher<String> equalsIgnoringWhiteSpace(String str);
Matcher<Comparable<T>> lessThan<T extends Comparable<T>>(Comparable<T> c);
Matcher<Comparable<T>> greaterThan<T extends Comparable<T>>(Comparable<T> c);
Matcher<Comparable<T>> lessThanOrEqualTo<T extends
Comparable<T>>(Comparable<T> c);
Matcher<T> greaterThanOrEqualTo<T extends Comparable<T>>(T c);
Matcher<Collection<E>> every(Matcher<E>);
Matcher<Collection<E>> some(Matcher<E>);
Matcher<bool> get isTrue();
Matcher<bool> get isFalse();
Matcher<num> get isPositive();
Matcher<num> get isNegative();
Matcher<num> get isNonPositive();
Matcher<num> get isNonNegative();
Matcher<num> get isZero();
Matcher<num> get isNonZero();
Matcher<Function> get throws();
Matcher<Function> get returnsNormally();
Matcher<Future> get completes();
example usage:
expect<bool>(b, isTrue);
expect<num>(i, lessThan<num>(6));
expect<String>(s, matches(new Regexp(@"\d+"));
The single argument form, "expect(x)", could be changed to
"expectTrue(x)" if "expect(x, isTrue)" is too long.
--
Sean Eagan