orderBy method
OrderBy
orderBy(
- dynamic attrs, [
- dynamic index
])
Implementation
OrderBy orderBy(attrs, [index]) {
if (attrs is Map && attrs.containsKey("index")) {
index = attrs;
attrs = [];
index.forEach((k, ob) {
if (ob is Asc || ob is Desc) {
//do nothing
} else {
ob = _funcWrap(ob, 1);
}
});
} else if (attrs is List) {
if (index is Map == false && index != null) {
attrs.add(index);
index = null;
}
attrs.forEach((ob) {
if (ob is Asc || ob is Desc) {
//do nothing
} else {
ob = _funcWrap(ob, 1);
}
});
} else {
List tmp = [];
tmp.add(attrs);
if (index is Map == false && index != null) {
tmp.add(index);
index = null;
}
attrs = tmp;
}
return OrderBy(_listify(attrs, this), index);
}