Hi Im following one of the yt tutorials and when I try to make a model this error occurs what is my best approach to solve this problem. I cannot put required because some values do take null. My project is based I'm taking global API I found on net similar to http://www.omdbapi.com/ (Im not using this but this is just a point of refference) and when I do so I get this error:
The parameter 'title' can't have a value of 'null' because of its type, but the implicit default value is 'null'.
Try adding either an explicit non-'null' default value or the 'required' modifier.dartmissing_default_value_for_parameter
{String title}
This is my books class:
class Book{
String name;
String title;
String city;
Book(
{this.name,
this.name,
this.name});
factory Book.fromJson(Map<String,dynamic> json){
return Book(
name: json['name'] as String,
title: json['title'] as String,
name: json['name'] as String,
);
}
}
What is the best solution to this problem because when they do it this way they have no error at all. Looking forward to your answers
Thanks in advance