fluttercommunity / plus_plugins

Flutter Community Plus Plugins
BSD 3-Clause "New" or "Revised" License
1.62k stars 979 forks source link

[Question]: Can I get only state Charging or Uncharged without state Full #1039

Open nxhung1610 opened 2 years ago

nxhung1610 commented 2 years ago

What is your question?

I'm making a alert to notify if laptop is plugged in or not , but when use battery_plus in state Full, i cant detect that Laptop is charging or not. Can some one help me ?

Chinmay-KB commented 2 years ago

I went through the source code of battery_plus for mac_os and found that if battery percentage is 95% regardless of it being plugged in or not, battery status will be returned as full. Only when the percentage goes below that is when you will get a charging or discharging status. What you are asking is pretty easy to implement into the plugin, if required. Now its up to the maintainers to decide whether to add it or not.

miquelbeltran commented 2 years ago

It is easy to implement on one platform, it is hard to port to the other 5.

Anyone willing to submit a PR is welcome to do it, I will help with the review and test.

SirusCodes commented 2 years ago

@miquelbeltran won't this be checking if the status if full at the end of switch case?