亲爱的,
我不知道如何将他的新 key 插入火力基地。
这是我的简单示例代码:
FirebaseDatabase.instance.reference().child('mychild').push().set(
<String, String>{
'hello': 'world',
});
我怎样才能得到这个元素的键被推送?
谢谢
最佳答案
你可以试试这个:
DatabaseReference rootRef = FirebaseDatabase.instance.reference();
String newkey = rootRef.child('mychild').push().key;
rootRef.child('mychild').child(newKey).set(<String, String>{'hello': 'world',});
关于firebase-realtime-database - 如何在firebase上推送新 key ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53682732/