sort property
The data comparator.
final pie = Pie(…)..sort = (a, b) => ascending(a["name"], b["name"]);
pie.sort; // (a, b) => ascending(a["name"], b["name"])
The data comparator takes two arguments a and b, each elements from the input data array. If the arc for a should be before the arc for b, then the comparator must return a number less than zero; if the arc for a should be after the arc for b, then the comparator must return a number greater than zero; returning zero means that the relative order of a and b is unspecified.
The data comparator defaults to null. If both the data comparator and the value comparator (see sortValues) are null, then arcs are positioned in the original input order. Setting the data comparator implicitly sets the value comparator to null.
Sorting does not affect the order of the generated arc list (see Pie.call) which is always in the same order as the input data list; it only affects the computed angles of each arc. The first arc starts at the startAngle and the last arc ends at the endAngle.
Implementation
int Function(T, T)? get sort => _sort;
Implementation
set sort(int Function(T, T)? sort) {
_sort = sort;
_sortValues = null;
}