Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 如何使用fromJson在地图中列出?_Dart_Flutter - Fatal编程技术网

Dart 如何使用fromJson在地图中列出?

Dart 如何使用fromJson在地图中列出?,dart,flutter,Dart,Flutter,通常,我会使用这段代码来创建列表 jsonMap.map((gallery) => new Gallery.fromJson(gallery)).toList(); 但是我不知道如何使用fromJson 我通过使用解决了这个问题 List.castFrom(json['galleries']).map((gallery) => new Gallery.fromJson(gallery)).toList();

通常,我会使用这段代码来创建列表

jsonMap.map((gallery) => new Gallery.fromJson(gallery)).toList();
但是我不知道如何使用fromJson


我通过使用解决了这个问题

List.castFrom(json['galleries']).map((gallery) => new Gallery.fromJson(gallery)).toList();