I got a JSON file with a long list of data like this.
[
[
[6.25575, 51.83439],
[6.26408, 51.83342]
],
[
[6.25575, 51.83439],
[6.26408, 51.83342]
]
]
When I write:
final List<List<List<double>>> data = await getJson('assets/data.json') as List<List<List<double>>>;
It gives the error: _CastError (type 'List<dynamic>' is not a subtype of type 'List<List<List<double>>>' in type cast).
getJson function:
Future<dynamic> getJson(String file) async {
final String jsonData = await rootBundle.loadString(file);
final dynamic data = await jsonDecode(jsonData);
return data;
}
How can a cast this list of lists to a List<List<List<double>>>?