urbanairship / airship-flutter

Flutter integration
Other
17 stars 16 forks source link

LateInitializationError: Local 'notification' has not been initialized. #108

Closed spencer-sf closed 2 years ago

spencer-sf commented 2 years ago

Preliminary Info

What Airship dependencies are you using?

airship_flutter: ^4.0.0 pubspec.lock: airship_flutter: 4.4.0 (Know this isn't the latest version but looking at the repo this issue is still present in latest)

Report

What unexpected behavior are you seeing?

When receiving a push notification payload on the client after triggering a push from the Apptentive Message center using their airship integration, the deserialization of that payload fails because there is no notification object in the payload.

The instance member notification is non-nullable, but the _fromJson method uses a late declaration and a null check in conjunction when they shouldn't be if notification can be null as it is in my case.

Screen Shot 2022-01-03 at 12 04 12 PM

What is the expected behavior?

Expect notification to be nullable if not present in payload

What are the steps to reproduce the unexpected behavior?

Send a notification without a notification property

Do you have logging for the issue?

Screen Shot 2022-01-03 at 11 47 35 AM
rlepinski commented 2 years ago

Thanks for the report, we will take a look

Ulrico972 commented 2 years ago

Hello, we noticed the issue and will prepare a fix for this

Ulrico972 commented 2 years ago

Hello, we released the version 5.1.1 that fixes your issue.