Skip to content

Instantly share code, notes, and snippets.

@mahdi-malv
Created September 10, 2020 12:22
Show Gist options
  • Save mahdi-malv/be83117b37a40b44869c97092583f744 to your computer and use it in GitHub Desktop.
Save mahdi-malv/be83117b37a40b44869c97092583f744 to your computer and use it in GitHub Desktop.
Flutter web with pushe applied
<body>
<!-- region Add pushe before your Flutter script -->
<script src="https://static.pushe.co/pusheweb.js"></script>
<script>
Pushe.init("app_id"); // App_id is retrieved via console.pushe.co
Pushe.subscribe({"showDialog":true,"showBell":false,"icon":"https://static.pushe.co/d/webpush/default-icon.png","title":"Get the latest news bro :D","content":"You want to be notified of every new event happenning to My site? Click OK then.","position":"top-center","direction":"ltr","acceptText":"OK, sure","rejectText":"Nuh","promptTheme":"pushe-prompt-theme2","mobilePosition":"top","dialogRetryRate":0});
</script>
<!-- endregion-->
<!-- region Flutter's own code -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('flutter_service_worker.js');
});
}
</script>
<!-- endregion -->
<script src="main.dart.js" type="application/javascript"></script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment