@@ -3,7 +3,7 @@ part of angular.formatter_internal;
3
3
typedef dynamic _Mapper (dynamic e);
4
4
5
5
/**
6
- * Orders the the elements of a list using a predicate.
6
+ * Orders the the elements of an [Iterable] using a predicate.
7
7
*
8
8
* # Usage
9
9
*
@@ -15,7 +15,7 @@ typedef dynamic _Mapper(dynamic e);
15
15
* - **a custom callable expression**: an expression that will be called to transform the element
16
16
* before a sort.
17
17
* - **a list**: the list may consist of either strings or callable expressions. A list expression
18
- * indicates a list of fallback expressions to use when a comparision results in the items
18
+ * indicates a list of fallback expressions to use when a comparison results in the items
19
19
* being equal.
20
20
*
21
21
* If the expression is explicitly empty(`orderBy:''` ), the elements are sorted in
@@ -166,10 +166,9 @@ class OrderBy implements Function {
166
166
* - `expression` : String/Function or Array of String/Function.
167
167
* - `descending` : When specified, use descending order. (The default is ascending order.)
168
168
*/
169
- List call (List items, var expression, [bool descending= false ]) {
170
- if (items == null ) {
171
- return null ;
172
- }
169
+ List call (Iterable items, var expression, [bool descending= false ]) {
170
+ if (items == null ) return null ;
171
+ if (items is ! List ) items = items.toList ();
173
172
List expressions = null ;
174
173
if (expression is String || expression is _Mapper ) {
175
174
expressions = [expression];
0 commit comments