I know this question have been asked before but I have tried it and still not working. That's why I post this question. Recreated the project many times and still cannot get it.
I initialize the firebase.
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_database/firebase_database.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(const MyApp());
}
DatabaseReference userRef = FirebaseDatabase.instance.ref('users');
I just wanted to insert data into the realtime database with this testing code
void _incrementCounter() {
setState(() {
userRef.child('testing').push().set({'testing1': 'hello', 'testing2': 'bye'});
_counter++;
});
}
I have added the required file at the
Application/android/app/google-service.json
I also added the required SDK as needed for firebase. I have also tested the playground for Realtime Firebase
Playground for realtime firebase
Help is very much appreciated.