Closed bjoernahrens closed 1 year ago
@bjoernahrens thank you for reporting,
@AndreiMisiukevich could you please take a look?
@furaiev sure!
@bjoernahrens nice catch! I agree that it makes more sense to refactor code and replace dynamics with nullable Strings for easier maintenance.
@bjoernahrens thanks for reporting, @AndreiMisiukevich thanks for fast fix!
Thank you for fixing it so quickly, really appreciated 👍
Definitely agree that it should be typed instead of dynamic
.
This bug was introduced in 3.1.0 by commit 1a43b15e03f2953e1d563be36f887d65fa15de3a
In
CognitoUser
line 195-196CognitoStorage.getItem
returns adynamic
type, which is really not optimal as then the Dart Analyzer ignores the fact that the value might benull
.In this case, the value returned in line 195 is
null
if no value was saved before. However,int.tryParse
has the following signatureThe parameter
source
is a non-optional string. When givennull
, Dart will throw aTypeError
at runtime.Error
s are usually not caught, so an app using this will crash.