The official docs for Firebase Authentication for Flutter mentions this code to check whether user is logged in or not: