Skip to content

fix(battery_plus): Fix return value of getBattery to be nullable#2745

Merged
miquelbeltran merged 1 commit into
fluttercommunity:mainfrom
koji-1009:fix/battery_plus_web
Mar 21, 2024
Merged

fix(battery_plus): Fix return value of getBattery to be nullable#2745
miquelbeltran merged 1 commit into
fluttercommunity:mainfrom
koji-1009:fix/battery_plus_web

Conversation

@koji-1009

Copy link
Copy Markdown
Contributor

Description

Fixed an exception that occurred when calling getBattery() in firefox and safari.
In cases where getBattery() is undefined, you need to declare JSPromise<BatteryManager>? instead of JSPromise<BatteryManager>.

The example code has been reverted to the previous one, as the try-catch is now correct.

Related Issues

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the plugin version in pubspec.yaml files.
  • All existing and new tests are passing.
  • The analyzer (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?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

@koji-1009

Copy link
Copy Markdown
Contributor Author

@miquelbeltran miquelbeltran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@miquelbeltran miquelbeltran merged commit 4d5b950 into fluttercommunity:main Mar 21, 2024
@koji-1009 koji-1009 deleted the fix/battery_plus_web branch March 21, 2024 21:53
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants