I made a class notification to initialise my data, but when I call it in my future function it shows me an error.
Future <List<Notification>> _getNotification() async {
var data = await http.get("$baseUrl/efficience001_webservice/notification.php");
var jsonData = json.decode(data.body);
List<Notification> notifs = [];
for (var u in jsonData){
Notification notif = Notification(u["description"],u["nom_ligne"], u["created_at"]);
notifs.add(notif);
}
print(notifs.length);
return notifs;
}
class Notification {
final String description;
final String nom_ligne;
final DateTime created_at;
const Notification({this.description, this.nom_ligne, this.created_at});
}
error: Too many positional arguments , 0 expected, but 3 found.