applySort method

void applySort(
  1. dynamic value
)

Áp dụng sắp xếp => cập nhật dữ liệu => cập nhật giao diện

Hỗ trợ kiểu

String?
Map<String, bool?>

Ví dụ

applySort('sortGia:1') // từ thấp tới cao
applySort('sortGia:-1') // từ cao tới thấp
// hoặc
applySort({
  'sortGia': true, // từ thấp tới cao
})
applySort({
  'sortGia': false, // từ cao tới thấp
})

Implementation

void applySort(dynamic value) {
  if (value == null) return;

  if (value is String?) {
    sorts.clear();
    sorts.addAll(Sort.getSorts(value));
    reload();
  } else if (value is Map<String, bool?>) {
    sorts.clear();
    sorts.addAll(value);
    reload();
  }
}