Handling focus changes in StateField

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?

Thank you!

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.

Thank you marijn!
I didn’t know focusChangeEffect that is what I was looking for!

Many thanks