If you call single() on a Flow, it will return the first object that the Flow emits. But, if the Flow emits more than one object, or if the Flow is closed before emitting its first object, single() throws an exception.

singleOrNull() returns null if the Flow is closed before emitting its first object. However, like single(), it throws an exception if the Flow is set up to emit more than one object.

You can learn more about this in:
Run Edit