fromString static method

SortDirection? fromString(
  1. String? value
)

Get the SortDirection from a String.

Implementation

static SortDirection? fromString(String? value) {
  if (value == null) return null;
  value = value.trim().toLowerCase();
  switch (value) {
    case 'asc':
    case 'ascending':
    case 'ascend':
    case 'up':
      return SortDirection.ascending;
    case 'desc':
    case 'descending':
    case 'descend':
    case 'down':
      return SortDirection.descending;
    default:
      return null;
  }
}