so I was making this sign up page in flutter using firebase authentication and realtime database. authentication works fine but I have a problem with database, it just isn't being created. I tried using push() as well, after following some instructions on google but it doesnt help. there aren't enough instructions on goggle regarding firebase realtime database. Any help will be appreciated!
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
DatabaseReference usersRef = FirebaseDatabase.instance.reference().child("users");
final FirebaseAuth _firebaseAuth = FirebaseAuth.instance;
void registerNewUser(BuildContext context) async {
final User firebaseUser = (await _firebaseAuth
.createUserWithEmailAndPassword(
email: emailTextEditingController.text,
password: passwordTextEditingController.text)
.catchError((errMsg) {
displayToastMessage("Error: " + errMsg.toString(), context);
}))
.user;
if (firebaseUser != null) {
Map userDataMap = {
"name": nameTextEditingController.text.trim(),
"email": emailTextEditingController.text.trim(),
"phone": phoneTextEditingController.text.trim(),
};
usersRef.child(firebaseUser.uid).set(userDataMap);
displayToastMessage("Account Created", context);
Navigator.pushNamedAndRemoveUntil(
context, MainScreen.idScreen, (route) => false);
//here
} else {
displayToastMessage("Account Not Created", context);
}
}
debug Console
Launching lib/main.dart on M2003J15SC in debug mode...
lib/main.dart:1
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:46469/nnTIbYfPB8Q=/ws
I/GED (24582): ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
I/deu.lagdeuride(24582): ProcessProfilingInfo new_methods=1227 is saved saved_to_disk=1 resolve_classes_delay=8000
W/IInputConnectionWrapper(24582): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24582): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(24582): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(24582): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(24582): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24582): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24582): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24582): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(24582): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(24582): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(24582): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(24582): endBatchEdit on inactive InputConnection
W/System (24582): Ignoring header X-Firebase-Locale because its value was null.
I/System.out(24582): [okhttp]:check permission begin!
W/System (24582): ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out(24582): [okhttp] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
I/System.out(24582): [socket]:check permission begin!
W/System (24582): ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out(24582): [socket] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
I/System.out(24582): [OkHttp] sendRequest<<
W/System (24582): Ignoring header X-Firebase-Locale because its value was null.
I/System.out(24582): [okhttp]:check permission begin!
W/System (24582): ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out(24582): [okhttp] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
I/System.out(24582): [OkHttp] sendRequest<<
D/FirebaseAuth(24582): Notifying id token listeners about user ( hULpKuZcGNhVE45xcR5RkrlCPTl1 ).
D/FirebaseAuth(24582): Notifying auth state listeners about user ( hULpKuZcGNhVE45xcR5RkrlCPTl1 ).
D/ViewRootImpl[Toast](24582): hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
I/Toast (24582): Show toast from OpPackageName:com.lagdeu.lagdeurider, PackageName:com.lagdeu.lagdeurider
D/Surface (24582): Surface::connect(this=0x77eefc2000,api=1)
D/mali_winsys(24582): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/Surface (24582): Surface::setBufferCount(this=0x77eefc2000,bufferCount=3)
D/Surface (24582): Surface::allocateBuffers(this=0x77eefc2000)
I/System.out(24582): [socket]:check permission begin!
W/System (24582): ClassLoader referenced unknown path: system/framework/mediatek-cta.jar
I/System.out(24582): [socket] e:java.lang.ClassNotFoundException: com.mediatek.cta.CtaUtils
D/Surface (24582): Surface::disconnect(this=0x77eefc2000,api=1)
D/View (24582): [Warning] assignParent to null: this = android.widget.LinearLayout{7763522 V.E...... ......ID 0,0-564,316}
output is empty.