要从DataSnapshot访问密钥,只需使用snapshot.key即可,在您的案例中,您将拥有该项目的相对密钥。
.then((onValue) { onValue.map(data => { var key = data.key }) });或仅使用Firebase文档中提供的内容
.then(function(snapshot) { snapshot.forEach(function(childSnapshot) { var key = childSnapshot.key; // you will get your key here });});


