how can i archive tristate for checkbox with nullsafety.... i have to pass null into that value but nullsafety has to perform null check on a variable, this is just contradicting .....
putting null check as usual:
bool? parentvalue;
void update() {
parentvalue = null;
}
Checkbox(
....
value: parentvalue!,
onChanged: update(),
....
),
ERROR: Null check operator used on a null value
if i remove null check...code cannot compile at all
bool parentvalue;
void update() {
parentvalue = null;
}
Checkbox(
....
value: parentvalue,
onChanged: update(),
....
),
ERROR: A value of type 'Null' can't be assigned to a variable of type 'bool'.
Aucun commentaire:
Enregistrer un commentaire