feat(battery_plus): Added power source type of how the device is powered. #2612
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR updates the battery_plus plugin to handle power source type fetching on mobile.
When you request the PowerSource type from the plugin it will try to get the source type from the intent battery changed extras, to indicate if the power source is AC, USB, Wireless or by battery.
Motivation
We work with mobile scanner devices that run on Android and are socketed in Cradles for their charging and release to the users.
There is no communication between the cradle and the scanner to detect if the scanner is in the cradle except for its power state. With the current version of the battery_plus package, we can detect whether the system is charging. But for development purposes, as an example, it is possible to also have a USB cable attached to the device.
This will break the charging logic, and we require a second parameter to determine if the power source is our USB cable, the cradle, or the battery.
Checklist
CHANGELOG.md
nor the plugin version inpubspec.yaml
files.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?
!
in the title as explained in Conventional Commits).