Restart.restartApp() uses a platform channel and must run on the main isolate. Calling it from a background isolate throws:
Send a message from the background isolate to the main isolate instead.