通常,我将使用此代码进行列表。
jsonMap.map((gallery) => new Gallery.fromJson(gallery)).toList();
但我不知道如何使用fromJson。
This is a picture of my code.
我通过使用解决了这个问题。
List.castFrom(json['galleries']).map((gallery) => new Gallery.fromJson(gallery)).toList();