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

Bug: SetScanPeriod and SetBetweenScanPeriod Methods Missing Return Statements Leading to IllegalStateException #146

Open
ktanaka101 opened this issue Nov 15, 2024 · 1 comment · May be fixed by #147

Comments

@ktanaka101
Copy link

Summary:

In the FlutterBeaconPlugin, the setScanPeriod and setBetweenScanPeriod method handlers within the onMethodCall function do not include return statements after invoking result.success or result.error.

This omission causes the method to continue execution and inadvertently call result.notImplemented(),
resulting in an IllegalStateException due to multiple responses being sent for a single method call.

Steps to Reproduce:

  1. Invoke the setScanPeriod method from the Flutter side with a valid scanPeriod argument.
  2. Observe that after successfully setting the scan period, an IllegalStateException is thrown.
    Log: java.lang.IllegalStateException: Reply already submitted
ktanaka101 added a commit to ktanaka101/flutter_beacon that referenced this issue Nov 15, 2024
…to prevent IllegalStateException

This commit adds missing return statements after result.success and result.error calls in the setScanPeriod and setBetweenScanPeriod methods. This prevents the method from continuing execution and inadvertently calling result.notImplemented(), which was causing IllegalStateException due to multiple responses being sent for a single method call.

Closes alann-maulana#146
@dariocavada
Copy link
Contributor

Try the updated version of this library, now ported to Kotlin with support for Flutter 3.x, Gradle, and an improved example:
https://pub.dev/packages/dchs_flutter_beacon

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