Flutter Firebase realtime once()。then()在重新运行时不会更新
当我使用once.then读取数据,如果我再次运行它不会更新变量或给出null
once()方法正是它的名字所暗示的:它只读取一次数据,而不监视更新。正如documentation所说:
once()
侦听单个值事件,然后停止侦听。
要获得实时更新,请使用其中一个on...流,例如onValue:
on...
onValue
更新此位置的数据时触发。