Closed
Description
With the following code:
int get i {
int result;
assert(() {
if (false) {
result = 1;
}
return true;
}());
if (result == null) {
throw Error();
}
return result;
}
the migration tool suggests:
int? get i {
int? result;
assert(() {
if (false) {
result = 1;
}
return true;
}());
if (result == null) {
throw Error();
}
return result;
}
but the return type of the method should be int
instead of int?
because of the null gard at the end.
Without assert the migration tool works correctly and suggest:
int get i {
int? result;
// assert(() {
// if (false) {
// result = 1;
// }
// return true;
// }());
if (result == null) {
throw Error();
}
return result;
}