Follow This Step by Step Process
Step 1 : Try to launch on chrome not on Edge browser : -> If work then no need to change
Step 2 : If get same result on any browser
Like if app not launch or launch but not anything view in browser (Like white screen) and not received any error.
Do Following change in index.html file in web directory of your project
Check following function must be last tab in index file
<script>
window.addEventListener('load', function (ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function (engineInitializer) {
engineInitializer.initializeEngine().then(function (appRunner) {
appRunner.runApp();
});
}
});
});
</script>
<script src="main.dart.js" type="application/javascript"></script>
for more reference I provide you whole index.html file of my personal flutter project (TechCureIndia)
<!DOCTYPE html>
<html>
<head>
<base href="/">
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<!-- Description -->
<meta name="description"
content="We are experts in workstatuions and gaming pc's | AI & deep learning pc | Architechture & Engineering pc | visual designer & video editor pc | trading pc | Audio production pc | Gaming pc | amd series | custom liquid cooling setup | Cryptocurrency mining rigs | All IT peripherals & much more.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- Change TITLE -->
<meta name="apple-mobile-web-app-title" content="Tech Cure India">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<!-- <link rel="icon" type="image/png" href="favicon.png" /> -->
<!-- Use .ico favicon -->
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<!-- Change TITLE -->
<title>Tech Cure India</title>
<link rel="manifest" href="manifest.json">
<script>
// The value below is injected by flutter build, do not touch.
const serviceWorkerVersion = "2091515534";
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
<!-- This is for js in flutterWeb-->
<script src="appscript.js" defer></script>
<!-- This is for load our css file-->
<link rel="stylesheet" type="text/css" href="styles.css">
<!-- Toastify CSS -->
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
<!-- PDF View -->
<script>
var dartPdfJsVersion = "3.2.146";
</script>
</head>
<body>
<!-- Loading Indicator Below-->
<div class="loading">
<div class="loader"></div>
</div>
<!-- Loading Indicator Above-->
<!-- <script src="main.dart.js" type="application/javascript"></script> -->
<!-- Move above line bottom most-->
<!-- Firebase SetUp script type = 'module'-->
<!-- <script type="module">
import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";
const firebaseConfig = {
apiKey: "AIzaSyBenD4UHfJiCcodpSzYKFe4buxRg_ZfZic",
authDomain: "techcureindia.firebaseapp.com",
projectId: "techcureindia",
storageBucket: "techcureindia.appspot.com",
messagingSenderId: "1016267859555",
appId: "1:1016267859555:web:45e1e213f671b886323a56",
measurementId: "G-VNSZL96YJM"
};
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
</script> -->
<!-- Firebase INIT way 2.0 -->
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.17.1/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-messaging.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.5/firebase-analytics.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=yourKey"></script>
<script>
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyBenD4UHfJiCcodpSzYKFe4buxRg_ZfZic",
authDomain: "techcureindia.firebaseapp.com",
projectId: "techcureindia",
storageBucket: "techcureindia.appspot.com",
messagingSenderId: "1016267859555",
appId: "1:1016267859555:web:45e1e213f671b886323a56",
measurementId: "G-VNSZL96YJM"
};
/// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
<!-- Firebase INIT way 2.0 -->
<!-- syncfusion-PDF -->
<script src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.min.js"></script>
<script type="text/javascript">
pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.worker.min.js";
</script>
<script>
window.addEventListener('load', function (ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function (engineInitializer) {
engineInitializer.initializeEngine().then(function (appRunner) {
appRunner.runApp();
});
}
});
});
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
If you still get error please provide whole index.html file of your project
Hope this will help you