bytepark / auto_orientation

A flutter plugin to programmatically change the orientation and rotate
MIT License
46 stars 47 forks source link

[Android] Hangs when `await`ing a call #9

Closed lynn closed 3 years ago

lynn commented 4 years ago

Hi, I tried to use this package like so:

await AutoOrientation.landscapeLeftMode();

This works fine on iOS but hangs on Android. I'm actually supposed to not await the result, even though the function returns a Future, which confused me.

The implementation of onMethodCall

https://github.com/bytepark/auto_orientation/blob/dd9923557ae89d9a2b3168d523bb23f2f0c51838/android/src/main/java/de/bytepark/autoorientation/AutoOrientationPlugin.java#L28-L67

should probably end with a result.success(null); to prevent this possible confusion.

sfaujour commented 4 years ago

We had normally no issues on android, which android are you using? Maybe the line is missing, thats true.

mdelem commented 3 years ago

Adding the line result.success(null); fixes the issue for me on Android 7.1.2

Thanks @lynn and @sfaujour!

fbatschi commented 3 years ago

@mdelem feel free to submit a merge request

mdelem commented 3 years ago

There you go! https://github.com/bytepark/auto_orientation/pull/20

fbatschi commented 3 years ago

Thanks, merged.