Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(battery_plus): Fix type conversion #3153

Conversation

koji-1009
Copy link
Contributor

@koji-1009 koji-1009 commented Aug 7, 2024

Description

When wasm is used, there is a complete distinction between double and int. For this reason, casting a double type to an int type with as will cause a crash in the wasm environment. Fix this problem by changing from as int to toInt().


flutter/flutter#146231

Starting with flutter 3.24, the flutter run --wasm command makes it easy to try out the wasm version of the app at local.

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.

@miquelbeltran
Copy link
Member

Makes sense!

can you rebase this PR to #3103 ?

I'd also prefer if the PR only contained the toInt change and not the other files.

Thanks!

@koji-1009 koji-1009 changed the base branch from main to dependabot/pub/packages/battery_plus/battery_plus/web-1.0.0 August 7, 2024 23:17
@koji-1009 koji-1009 marked this pull request as ready for review August 7, 2024 23:17
@koji-1009
Copy link
Contributor Author

@miquelbeltran
I've finished rebasing and organizing the commits!

@miquelbeltran
Copy link
Member

Thank you! I will merge this one once #3103 lands

@miquelbeltran miquelbeltran deleted the branch fluttercommunity:dependabot/pub/packages/battery_plus/battery_plus/web-1.0.0 August 9, 2024 08:11
@miquelbeltran
Copy link
Member

ugh why is closed...

@miquelbeltran
Copy link
Member

For some reason GH closed this automatically instead of changing the target to main, reopening here #3157

@koji-1009 koji-1009 deleted the fix/wasm_type_error branch August 10, 2024 02:29
@koji-1009
Copy link
Contributor Author

No problem! Thanks Marge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants