You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have firebase realtime database. When I manually change data on the Firebase console, vscode stops responding and throws the following error. What is wrong in my code?
Error: TypeError: Instance of '_Exception': type '_Exception' is not a subtype of type 'JavaScriptObject'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have firebase realtime database. When I manually change data on the Firebase console, vscode stops responding and throws the following error. What is wrong in my code?
Error: TypeError: Instance of '_Exception': type '_Exception' is not a subtype of type 'JavaScriptObject'
main.dart
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:realtimedbtest/firebase_options.dart';
String result = "";
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
DatabaseReference ref = FirebaseDatabase.instance.ref('widget/image/name');
ref.onValue.listen((DatabaseEvent event) {
result = event.snapshot.value.toString();
});
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Text("result: $result"),
),
),
);
}
}
Beta Was this translation helpful? Give feedback.
All reactions