hi I'm creating a web app, i'm trying to have the toggle in the website it self if turned on it sends he is subscribed to a topic in firebase. i'm using flutter is there a way I tried searching all over but couldn't grasp it even in the documentation
I tried this way
<button type="button" onclick="subscribeTokenToTopic">Tag VIP User</button>
importScripts("https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js");
importScripts("https://www.gstatic.com/firebasejs/8.10.0/firebase-messaging.js");
const config = {
apiKey: "x",
authDomain: "x",
projectId: "x",
storageBucket: "x",
messagingSenderId: "x",
appId: "x",
measurementId: "x")
};
firebase.initializeApp(config);
function subscribeTokenToTopic(token, topic) {
await FirebaseMessaging.subscribeToTopic('weather');
}