FlexTableController constructor
- FlexTableFilterer? filterFn,
- FlexTableSorter? sortFn,
Controller for a FlexTable.
The optional filterFn function is used when filtering the data is
requested. The default implementation performs a equality test between
the filter. It will return true if the values do not match and false
if they match.
The optional sortFn function is used to perform sorting on the columns
when requested. The default implementation uses a case insensitive
comparitor to perform the sorting. When ascending is true, it will
return based on comparing the a value to the b value and returning the
result and when ascending is false, it will compare the b value to the
a value. For example when ascending is true "apple" will come before
"banana".
It's helpful to think of the ascending in terms of the logical list
rather than the visual representation of the table. So the data ascends
later in the list which results in it visually getting "larger" as you go
look further down the table.
To prevent memory leaks, be sure to dispose this when it is no longer needed.
Implementation
FlexTableController({FlexTableFilterer? filterFn, FlexTableSorter? sortFn})
: _filterFn =
filterFn ?? ((String filter, String value) => filter != value),
_sortFn =
sortFn ??
((bool ascending, String a, String b) {
final aValue = a.toLowerCase();
final bValue = b.toLowerCase();
return ascending
? aValue.compareTo(bValue)
: bValue.compareTo(aValue);
});