I have two actions that run on phone shake. The one is to update a page state variable of type color using the built in random color function the other is to reset text fields on a form. When the app is run on Android, everything works as expected. When running on iOS, the form resets but the color function/action doesn't run and update the page state (verified with the debugger checking the page state variable). The random color function works if I have a button on the screen that updates the page state but not on being called when shaking the phone.
Random color function doesn't run on iOS on phone shake but works on Android
See the comment above. I've called the function via a button instead of a shake and that works by updating the page state variable and the fill color gets changed as expected. I've reordered the order in which the two actions get called on shake, same lack of functioning. It works on Android but not on iOS. I'm using Xcode 15.4 and iOS 17.4. The debugger does not show the page state value changing when the simulator is shaken. I did notice in the log for the device, it throws an exception (same on Android but the Android works and the form reset also gets triggered on both Android and iOS, just the color change is not working) when the app loads:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method setAccelerationSamplingPeriod on channel dev.fluttercommunity.plus/sensors/method)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332:7)
<asynchronous suspension>
I can watch the page state variable to make sure it doesn't get changed. I can't find out to get into the code to put a breakpoint in the on shake code via local run and debugger but I'm assuming it is because the form reset runs as expected.
In the screen shots below shows the reset form being called and the debugger showing the color page state variable which doesn't change.