rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
289 stars 330 forks source link

fix bug with zero ARG_PROVIDER #308

Closed al-bezd closed 2 years ago

al-bezd commented 2 years ago

fix bug with zero ARG_PROVIDER

In my case, the provider is set to Null and because of this I cannot get the current coordinates, checking for zero and substituting an empty string solves this problem

justjcool commented 2 years ago

@al-bezd please format code json[Keys.ARG_PROVIDER] ?? "",

al-bezd commented 2 years ago

@al-bezd , пожалуйста, отформатируйте кодjson[Keys.ARG_PROVIDER] ?? "",

I don't quite understand what I need to do? can you write in more detail?

frankvollebregt commented 2 years ago

This other open PR achieves essentially the same thing. I think setting an emptry String is not a recommended approach, as it may lead to unexpected behaviour down the line.

Making it nullable instead (like the other PR now does) will also resolve the issue, but in a way that's more logical to understand, I think.

As an aside, I think the other person wanted you to add spaces, so go from json[Keys.ARG_PROVIDER]??"" to json[Keys.ARG_PROVIDER] ?? ""

al-bezd commented 2 years ago

null results in an error, since everything happens on the side of the package, I get nothing but an error

al-bezd commented 2 years ago

This other open PR doesn't solve my problem

frankvollebregt commented 2 years ago

Oh that's interesting, it logically should work. I'll write up a comment over there then. I see you made a new PR instead of updating this one, so I think you can safely close this PR

hieudz commented 2 years ago

pump, facing the same issue where json[Keys.ARG_PROVIDER] is null

Yukams commented 2 years ago

Hi @hieudz, you should hop on the version 2 of this lib https://pub.dev/packages/background_locator_2

hieudz commented 2 years ago

I've just seen that @Yukams. Thank you so much for your leadership

Yukams commented 2 years ago

You're welcome :)