larryaasen / upgrader

A Flutter package for prompting users to upgrade when there is a newer version of the app in the store.
MIT License
558 stars 271 forks source link

Null check operator on nullable value #284

Closed Jblew closed 1 year ago

Jblew commented 1 year ago

Hi! I've experienced a crash of upgrader with the following error: _CastError upgrader.dart in Upgrader._showDialog: Null check operator used on a null value

I have indeed found a mistake in that function. It's located in the /lib/src/upgrader.dart on lines 621 and 622. In the _showDialog function definition there is a String? title type yet on lines 621 & 622 you use non-null assertion title!. I think this could be replaced with title ?? ''

Link to code: https://github.com/larryaasen/upgrader/blob/f48fd39f2498767d518f42f62d13726b58c77828/lib/src/upgrader.dart#L621

Thank you! :)

larryaasen commented 1 year ago

@Jblew Thanks for pointing that out. I have a fix in the works now. Can you share with me your use case for this so I can properly test it?

Jblew commented 1 year ago

Well, my usecase turnus out to be my mistake honestly. I have wrapped MaterialApp inside the UpgradeAlert and not the other way. So actually looks like this situation happens only when the app is outside of the scope of MaterialLocalizations

larryaasen commented 1 year ago

@Jblew Good to know, I will try that. Thanks.

larryaasen commented 1 year ago

Fixed in version 6.5.0.