'Model class not recognizing return arguments
I am creating a model class for managing the results given by Googles Places API:
class PlaceSearch {
final String description;
final String placeId;
PlaceSearch(this.description, this.placeId);
factory PlaceSearch.fromJson(Map<String, dynamic> json){
return PlaceSearch(description: json['description'], placeId: json['place_id']);
}
}
But I am getting an error at line
return PlaceSearch(description: json['description'], placeId: json['place_id']);
The error is:
2 positional argument(s) expected, but 0 found
That class has been used in an older Flutter project, but now it is not working.
What should I change?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
