Cloud firestore sync if logged in

Form my first app I want to create a super simple Todo list.

I want to use cloud firestore with offline sync.

If the user is not logged in then it should not try and sync. However if the user is logged in to their account then I want it to also sync with cloud.

How would I do this the right way?