Hello,
This forum is for technical rather than legal advice (the latter of which the Firebase team members who frequent here are unqualified to dispense). As mentioned in
Introduction to user consent management from Google Analytics, "Many countries and regions have laws that require advertisers to get users’ consent to store and share information about them. These laws vary by jurisdiction and change over time. It is your responsibility, as an advertiser, to understand the laws that affect you and to implement consent management solutions for any data you share with Google."
Therefore we can only show you
how you can "add a toggle to turn ON/OFF analytics or to show a dialog/popup with a question if a user allows me to use Google Analytics" and not
if you should do so as this is up to you and any legal representatives you may or may not have.
If you have questions about how to do some of these things, we'd love to help.
Regards,
Joe