amazon-cognito-identity-dart-2 icon indicating copy to clipboard operation
amazon-cognito-identity-dart-2 copied to clipboard

Null Safety error

Open luna-vasconcelos opened this issue 3 years ago • 6 comments

Hi, I'm trying to use the package for AWS API gateway and lambda function, but I'm getting a null safety error from the package itself, I'm using the last version of it and getting the following error when launching the app:

image

luna-vasconcelos avatar Sep 22 '21 14:09 luna-vasconcelos

Hello, Is your app a null safety?

furaiev avatar Sep 22 '21 16:09 furaiev

Yes, it is

luna-vasconcelos avatar Sep 24 '21 00:09 luna-vasconcelos

Please add flutter doctor -v results

furaiev avatar Sep 24 '21 07:09 furaiev

hey, i was able to make it work, inserting null checks in the source code on these two variables: headers![x_amz_date] = datetime; headers![x_amz_security_token] = awsSigV4Client.sessionToken;

so i changed both to be like this: headers![x_amz_date] = datetime!; headers![x_amz_security_token] = awsSigV4Client.sessionToken!;

since the only problem was the null safety, this did the work, can you check?

luna-vasconcelos avatar Sep 27 '21 22:09 luna-vasconcelos

could you please point the lines in the file? It seems like all is null safe. https://github.com/furaiev/amazon-cognito-identity-dart-2/blob/main/lib/sig_v4.dart

The headers are declared as Map<String, String?>? headers; so the values can be nullable.

furaiev avatar Sep 28 '21 06:09 furaiev

yes, so, the lines that were returning the problem was 84 and 91, I think the problem was on the const amz_date and const amz_security_token, I think because they are both const, they could still return null but the other variables are on null safety, so when i added the null check with the "!" this solved the problem. I think that's what was happening

luna-vasconcelos avatar Sep 29 '21 13:09 luna-vasconcelos

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jul 28 '23 02:07 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Aug 12 '23 01:08 github-actions[bot]