I'm making my first Flutter + Firebase application, and I'm experiencing a strange error on the web app, when deployed on Firebase Hosting. When I launch the application locally in Chrome browser there's no error and the app works perfectly. The application is basically empty, it is the default counter app.
Does anyone have any idea of what the problem could be?
I tried removing all the Firebase services imports and dependencies, but nothing changed.
This is the error message shown in the JavaScript console:
Uncaught Error: undefined
Z5 https://midika.web.app/main.dart.js:12944
s https://midika.web.app/main.dart.js:5230
$2 https://midika.web.app/main.dart.js:26828
a4 https://midika.web.app/main.dart.js:5216
Z5 https://midika.web.app/main.dart.js:12970
<anonymous> https://midika.web.app/main.dart.js:51052
<anonymous> https://midika.web.app/main.dart.js:51046
dartProgram https://midika.web.app/main.dart.js:51049
<anonymous> https://midika.web.app/main.dart.js:51052
main.dart.js:3675:3
a https://midika.web.app/main.dart.js:3675
$0 https://midika.web.app/main.dart.js:27400
agx https://midika.web.app/main.dart.js:5378
agI https://midika.web.app/main.dart.js:5380
$1 https://midika.web.app/main.dart.js:26761
ahu https://midika.web.app/main.dart.js:3756
s https://midika.web.app/main.dart.js:3764
(Async: MutationCallback)
aeA https://midika.web.app/main.dart.js:5199
<anonymous> https://midika.web.app/main.dart.js:50913
c https://midika.web.app/main.dart.js:36
a62 https://midika.web.app/main.dart.js:5385
nN https://midika.web.app/main.dart.js:5442
m5 https://midika.web.app/main.dart.js:27034
nn https://midika.web.app/main.dart.js:26818
a2 https://midika.web.app/main.dart.js:5221
Z5 https://midika.web.app/main.dart.js:12942
s https://midika.web.app/main.dart.js:5230
$2 https://midika.web.app/main.dart.js:26828
a4 https://midika.web.app/main.dart.js:5216
Z5 https://midika.web.app/main.dart.js:12970
<anonymous> https://midika.web.app/main.dart.js:51052
<anonymous> https://midika.web.app/main.dart.js:51046
dartProgram https://midika.web.app/main.dart.js:51049
<anonymous> https://midika.web.app/main.dart.js:51052
Solution:
In the index.html file, the import of main.dart.js was before of all firebase imports. Moving this import at the end of the file solved the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.