Depends on the situation, no?
Unexpected current on a line otherwise thought to be safe? Utility records indicate no generating source on the otherwise dead circuit?
Are you a lineman or otherwise qualified?
No one on here will ever recommend connecting any equipment that could push power to a dead grid. We have had a few people ask questions about systems with manual transfer switching and that must be done properly and to code to be safe. Properly installed interlocked breakers can be made safe, but it requires a careful installation to ensure that both breakers can never be on at the same time.
What is more commonly recommended is an inverter with a built in transfer switch that conforms to the UL-1741 grid tie regulations. That way it takes human error out of this situation. If you are not confident in what you are doing, leave this to part to a qualified electrician. Even the proper code compliant gear is only completely safe when installed properly as well.
As for the original question...
Any decent grid tie inverter already has the "Anti Islanding" protection built in, but for this situation where no grid export is a system goal, a grid tie inverter is probably not the best way to go. I would recommend a hybrid inverter with zero sell capabilities. Having a storage battery allows you to use the extra solar power when the sun shines instead of just curtailing it an losing that extra power/energy. The easiest way to do it is by adding a sub panel with the loads you want to run on solar power. Many inverters can do this easily and never export back to the grid input side. But then you need an inverter with enough power to run everything you put in the backup loads panel. The function you are looking for is typically called "Grid Support" or "Load Shave". There may be other names as well. Cheaper inverters can only run when they disconnect from the grid. This is fine for backup power, but when the grid is good, you don't want to disconnect and run totally on solar/battery unless you size the system large enough to do that full time. What "Grid Support" does is add power to the inverter output side. This requires an inverter that can sync to the grid. In the case of my Schneider XW-Pro inverter, it allows me to set the current threshold. If the loads in the backup panel require more than your set threshold current, it will use battery power to keep the grid current below this setting. I have mine set to just 0.1 amps. Any load more than just 1/10th of an amp comes from my battery bank which is charged from a solar charge controller. If the battery runs too low, then the load just runs off of grid power. It's that simple.
Having a hybrid inverter that can push back to the main panel allows you to also power loads in the main panel while the grid is up. But when the grid goes down, you will only be connected to the loads in the backup panel. Check the specifications of the inverter carefully for this function. To be able to push to the main panel but still have zero export will require grid sensing CTs (current transformers). The better inverters should allow you to set an offset. For example, set it to always pull 0.5 amps from the grid. If the power draw within the home is less than 0.5 amps, then the inverter will push nothing back to it's input side and only cover the loads connected to it's output... the backup loads panel. If a load in the main panel pulls more than 0.5 amps, then the inverter will push the difference towards the grid. Right now my inverter is pushing 93 watts back to my main panel, but 5 minutes ago it was up at 1,200 watts as it was running the dishwasher. And that is the tricky part about zero export. As the load changes, the inverter needs to react to the change. If true zero export is needed, meaning no export ever, not even transients, then you need to put all the big loads after the inverter. That responds far quicker than having to read the CTs and make an adjustment after a load change has happened. Again, my XW-Pro supports this as well, but to do "Zero Export" mode with just the inverter's built in software, you need to add on a "Watt-Node" power meter with CTs back in the main panel. This is not native to the inverter. Using a separate box and a serial data bus connection adds a bit to the reaction time. It can't instantly adjust to a change in load, so they never promise it will never export any power. Many of the newer hybrid systems have the CT setup internal and should respond faster to load changes and reduce any spurious grid export. The Schneider inverter is a great piece of hardware, but the built in software is lacking a bit and each function is an add on box. If I was adding my battery system today, I might try the EG4 18K-PV. It does not seem to be as robust of an inverter, and I am not sure how much control you can have over it, but it is a one box solution that claims to do all of this without jumping through the hoops I did.