My data from JSON gives an error when fetching, and it does not display when exported to pdf, any suggestions how to fix this? Thank you.
class User {
final int id;
final String name;
final String position;
User(
{this.id,
this.name,
this.position,
});
factory User.fromMap(Map<String, dynamic> json) => User(
id: json["id"],
name: json["name"],
position: json["position"],
);
}
class PdfApi {
static Future<File> generateTable() async {
var url = Uri.parse('https:....');
var response = await http.get(url);
final jsonData = json.decode(response.body);
final pdf = Document();
final headers = [
'id',
'name',
'position',
];
final data = jsonData.map<User>((json) => User.fromMap(json)).toList();
}
}