-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[battery] Port battery to use platform interface #2980
Conversation
Hey @ditman kindly have a look at this one :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! However the current master is failing a test. I'll merge this once that gets fixed!
Sounds good :) Thank you @ditman . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, lots of red! Let's merge this. Thanks for the contribution!
Tagged and published as |
Thank you sir! |
Hey @ditman , I had a query, I was working on it's linux version and and for that I don't need to make method call as I can get data by opening 2 files in dart only. For that to work I have to make |
@yash1200 on Linux you just need to implement the calls to the Method Channel of the battery interface in C++, similar to this: No need to override anything on the platform interface. I hope that helps! |
Method channel can be implemented in Linux but I don't know about event channels. I couldn't find anything on it on flutter engine docs. That's why I was trying to implement it like this. This way it can be done using Dart only, as I have to listen to file |
@yash1200 shared_preferences_linux seems to be written in Dart also, you might want to use it as an additional example: https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences_linux What's the problem? Also, do you think there's a more portable way to check the battery? it seems there can be multiple BATx devices (some blog posts I see BAT0) |
Thanks for the information @ditman . Just had a little confusion in it and it's resolved now. And for the BATx , there are only two versions of it. This differs with distros. I'll add a check for this in the plugin 😀. Thanks again. |
Description
In this PR, I have ported
battery
to usebattery_platform_package
.Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?