async function updateManifest() { // Wait for Flutter to initialize and F.title to be available window.addEventListener("flutter-first-frame", async function () { const title = window.getTitle(); if (title) { // Fetch the template const response = await fetch("manifest.template.json"); const template = await response.json(); // Update the manifest with the correct title template.name = title; template.short_name = title; // Create a Blob with the modified manifest const blob = new Blob([JSON.stringify(template, null, 2)], { type: "application/json", }); const manifestUrl = URL.createObjectURL(blob); // Update the manifest link const manifestLink = document.querySelector('link[rel="manifest"]'); manifestLink.href = manifestUrl; } }); } updateManifest();