问题
I have been trying to save a list of lists using shared preferences in dart. For example, I have a list List data = [["dave","21","M"],["steven","22","F"]]
and I am trying to save and load as it is but app keeps throwing Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'List<String>'
I have tried converting the 2d list into a list using List new_data = data.expand((i) => i).toList();
and then saving it. But still, the exception persists even though it is a list containing only strings.
来源:https://stackoverflow.com/questions/56198413/how-to-save-and-get-a-list-of-lists-using-shared-preferences-in-dart-flutter