Issue
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']);
}
}
I am trying to implement Pexels API into a wallpaper application but Android studio is flagging the factory class as an error that it needs a body. What could have gone wrong?
Solution
The problem is a missing semicolon ;
on this line.
WallpaperModel({ required this.src, required this.photographer_url,required this.photographer_id, required this.photographer});
Answered By - Tim Jacobs
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.