| Index: utils/pub/utils.dart
|
| diff --git a/utils/pub/utils.dart b/utils/pub/utils.dart
|
| index 39c86dfa274c5b42f403da69618b84c3f92a7bb7..d0c2f435d21de48cd5cefdfb5a116148f503931d 100644
|
| --- a/utils/pub/utils.dart
|
| +++ b/utils/pub/utils.dart
|
| @@ -50,3 +50,14 @@ List flatten(List nested) {
|
| helper(nested);
|
| return result;
|
| }
|
| +
|
| +/**
|
| + * Asserts that [iter] contains only one element, and returns it.
|
| + */
|
| +only(Iterable iter) {
|
| + var iterator = iter.iterator();
|
| + assert(iterator.hasNext());
|
| + var obj = iterator.next();
|
| + assert(!iterator.hasNext());
|
| + return obj;
|
| +}
|
|
|