Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PushNotifications.fromJson fails without devices #2014

Closed
1 of 2 tasks
konrad-xtention opened this issue Feb 3, 2025 · 0 comments · Fixed by #2015
Closed
1 of 2 tasks

PushNotifications.fromJson fails without devices #2014

konrad-xtention opened this issue Feb 3, 2025 · 0 comments · Fixed by #2015
Assignees
Labels
bug Something isn't working

Comments

@konrad-xtention
Copy link
Contributor

Checklist

  • I could not find a solution in the documentation, the existing issues or discussions.
  • I already asked for help in the chat

In which Project did the bug appear?

Other

If you selected "Other" as Project, please enter in which project the bug occurred.

No response

On which platform did the bug appear?

Android

SDK Version

0.37.0

Describe the problem caused by this bug

In 0.37.0, all fields of PushNotification were made optional. But despite this change, PushNotifications.fromJson fails when no devices are present.

It should be possible to use fromJson on Json from toJson, but this throws an exception:

final PushNotification notification = PushNotification.fromJson(PushNotification().toJson());

Steps To Reproduce

Minimal reproduction:

final PushNotification notification = PushNotification.fromJson({});

Expected result: Get a PushNotification with all fields set to null.
Actual result: An exception is thrown.

Screenshots or Logs

type 'Null' is not a subtype of type 'String' in type cast

Security related

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants