When transferring file using wifi between 2 devices, say between a computer and a smartphone. Does every package need to go through the wifi router?
Yes, all the traffic flows through the router. Devices connect to the router, not to each other. The router acts like a post office, receiving the packets and delivering them to the proper address.