I want a function that takes a list of lists. It should sort this list of lists, regardless of its type, by the length of each list within it.
I thought I could achieve this by using the function below, but I am getting type errors. X is not a subtype of Y. From my understanding, using dynamic means it can take any type, so what am I doing wrong? 
List<List<dynamic>> sortByLength(List<List<dynamic>> lss) {
  final newLss = List.from(lss);
  return newLss..sort((a, b) => a.length.compareTo(b.length));
}
>.from` use `List.of` instead. The latter works with type inference, but cannot do downcasts.