You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
final lastTransaction = transactions.lastOrNull;
if (lastTransaction?.expirationDate ==null) {
returnfalse;
}
final expirationDate =DateTime.tryParse(lastTransaction!.expirationDate!);
If I remove the !, I get an analyser error saying I can't use lastTransaction because it can be null. I believe the analyser should be able to conclude that lastTransaction can't be null, because it's a final local variable, and the ?. in the if check would ensure there's no valid code path for it to still be null.
The text was updated successfully, but these errors were encountered:
final expirationDate = transactions.lastOrNull?.expirationDate;
if (expirationDate ==null) {
returnfalse;
}
final parsedExpirationDate =DateTime.tryParse(expirationDate);
Consider this code:
If I remove the
!
, I get an analyser error saying I can't uselastTransaction
because it can benull
. I believe the analyser should be able to conclude thatlastTransaction
can't benull
, because it's a final local variable, and the?.
in theif
check would ensure there's no valid code path for it to still benull
.The text was updated successfully, but these errors were encountered: