Android studio一直告诉我工厂类需要一个body,这有什么不对吗?


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']);
}
}

我试图实现像素API到壁纸应用程序,但Android工作室是标记工厂类作为一个错误,它需要一个机构。哪里出了问题?

问题是本行缺少分号;

WallpaperModel({ required this.src, required this.photographer_url,required this.photographer_id, required this.photographer});

相关内容

最新更新