<disclaimer - oppion of a flow novice>
Dont use either unless you need multiple consumers or multiple producers to the flow.
Use SharedFlow if you want to model "events" -- i.e. if the data in the flow must be preserved in kind and count, as one might use as FIFO queue.
Use StateFlow if you want to model "state" -- i.e a value that changes -- where you are NOT interested in nor need to know every time the state is updated, but rather only when it changes AND only need to know the latest state value -- i.e that its OK to lose 'state changes' if they end up with the same value at the end.