compare method
Compare two P
properties returned by the mapper.
Implementation
@override
int compare(P a, P b) {
final aIndex = order.indexOf(a);
if (aIndex == -1) {
throw StateError(
'Cannot sort value "$a". Add it to the order list first.',
);
}
final bIndex = order.indexOf(b);
if (bIndex == -1) {
throw StateError(
'Cannot sort value "$b". Add it to the order list first.',
);
}
return aIndex.compareTo(bIndex);
}