I'm having a list of different types of values exported from JSON.
class StudentDetailsToMarkAttendance {
int att_on_off_status;
String name;
String reg_number;
int status;
StudentDetailsToMarkAttendance(
{this.att_on_off_status, this.name, this.reg_number, this.status});
factory StudentDetailsToMarkAttendance.fromJson(Map<String, dynamic> json) {
return StudentDetailsToMarkAttendance(
att_on_off_status: json['att_on_off_status'],
name: json['name'],
reg_number: json['reg_number'],
status: json['status'],
);
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['att_on_off_status'] = this.att_on_off_status;
data['name'] = this.name;
data['reg_number'] = this.reg_number;
data['status'] = this.status;
return data;
}
}
I am trying to use the value of status as the value parameter of Checkbox
. I am trying to parse int
to String
like this.
value:((widget.studentDetailsList[index].status = (1 ? true : false) as int)as bool)
but there seems to be a problem with this conversion. I am not getting exact way of converting int
to bool
in dart. It says
Conditions must have a static type of 'bool'.
myInt == 1
– Yellowthroat