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 將工廠類標記為需要主體的錯誤。可能出了什么問題?
uj5u.com熱心網友回復:
問題是;該行缺少分號。
WallpaperModel({ required this.src, required this.photographer_url,required this.photographer_id, required this.photographer});
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/339891.html
