I’m trying to implement StateField to update the state by focus changes but I didn’t find any hint to handle focus changes in StateField update function.
I know ViewUpdate has focusChanged property for that case, but Transaction doesn’t.
How to handle focus changes in StateField update function?
Should I use UpdateListener which dispatches some effect like FocusChangeEffect when focusChanged?
By default, focus changes do not cause transactions and thus cannot be observed by the editor state. You can use focusChangeEffect to tell the editor to dispatch a given effect when focus changes, and react to those in your state field update method.