AliCoil Part of the Android security design is that locking the bootloader and unlocking the bootloader both wipe the user data partition (instantly, by destroying the cryptographic keys that were used to encrypt it). "Factory reset" also wipes the user data partition (again, cryptographically, on modern Android devices).
If you've "factory reset" the device, and then unlocked the bootloader, and then flashed a new OS, and then locked the bootloader, the only thing that you could do to improve the certainty that the device is wiped would be to throw it into the mouth of an active volcano (this is what government agencies do, though typically with an artificial volcano, and some use grinders instead). Throwing a phone into a volcano is likely to substantially reduce the resale value.