【发布时间】:2021-12-13 11:27:55
【问题描述】:
class WallpaperModel{
late String photographer;
late String photographer_url;
late int photographer_id;
SrcModel src;
WallpaperModel({ required this.src, required this.photographer_url,required this.photographer_id, required this.photographer})
factory WallpaperModel.fromMap(Map<String,dynamic> jsonData){
return WallpaperModel(src: jsonData['src'],
photographer_url: jsonData['photographer_url'],
photographer_id: jsonData['photographer_id'],
photographer: jsonData['photographer']);
}
}
我正在尝试将 Pexels API 实现到壁纸应用程序中,但 Android Studio 将工厂类标记为需要主体的错误。可能出了什么问题?
【问题讨论】:
标签: flutter api android-studio dart factory