orderByLength method

List<String> orderByLength({
  1. required String one,
  2. required String two,
})

Compare two strings by your length and return a list with the bigger at the first place and shorter at the second place.

Implementation

List<String> orderByLength({required String one, required String two}) {
  if (one.length > two.length) {
    return [one, two];
  } else {
    return [two, one];
  }
}