csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
351 stars 218 forks source link

[iOS] Entering page again to initialize, the last statusListener is unable to update widgets. #514

Open wtto00 opened 3 weeks ago

wtto00 commented 3 weeks ago

When you first enter the page, initialize and bind the onStatus parameter statusListener. In the callback, change the state widget.

When you navigator back and enter the page again, re-execute initialize, which will execute the return successfully without overwriting the new statusListener callback. This will cause the widget changed in the callback to be the widget of the first initialized page, rather than the state widget of the current page, resulting in the inability to change the state widget of the current page.

You can only manually reassign statusListener = _statusListener, rebind the state change callback to update the state widget of the current page.