i am trying to run my flutter web app with firebase realtime database but whenever i run the app a keep getting this error
Error: MissingPluginException(No implementation found for method Query#observe on channel plugins.flutter.io/firebase_database)
my index.html file looks like this
<!DOCTYPE html>
<html>
<head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.
The path provided below has to start and end with a slash "/" in order for
it to work correctly.
Fore more details:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
-->
<base href="/">
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="altec_web">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png" />
<title>altec_web</title>
<link rel="manifest" href="manifest.json">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('flutter-first-frame', function() {
navigator.serviceWorker.register('flutter_service_worker.js');
});
}
</script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-database.js"></script>
<script>
var firebaseConfig = {
apiKey: ".......",
authDomain: "......",
databaseURL: ".....",
projectId: "......",
storageBucket: "....",
messagingSenderId: "....",
appId: ".......",
measurementId: "........",
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.database();
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
my dependencies
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
fl_chart: ^0.40.2
syncfusion_flutter_charts: ^18.1.55
flutter_svg: ^0.22.0
syncfusion_flutter_gauges: ^18.1.55
firebase_core: ^0.7.0
firebase_auth: "^0.20.1"
cupertino_icons: ^1.0.2
google_fonts: ^1.1.2
supercharged: ^2.1.1
simple_animations: ^4.0.1
firebase_db_web_unofficial: ^0.0.2
cached_network_image: ^2.5.1
firebase_database: ^6.0.0
dev_dependencies:
flutter_test:
sdk: flutter
i first thought that the issue was caused by the firebase package, but i have checked there GitHub page and found that firebase realtime dose support flutter web
any idea what is the issue ?
main.dart.jsinto their HTML, and leave the importing of the specific SDKs to the library, based on the config and imports in the dart code. I recommend giving that a try.