certainly not a requirement where I live (local FD will come install battery ones and replace them annually if requested by disabled/elderly folks)
Requirement is that you have them, preference is for hard wired, though mine are all battery operated (Nest protects).