You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
when setting a value of DatabaseReference to null using update, FirebaseDatabase removes this value from the database. MockDatabaseReference.update inserts a null value instead
How to reproduce:
test('MockDatabaseReference removes value when updating with null', () async {
DatabaseReference reference =MockFirebaseDatabase.instance.ref('path'); // test works with FirebaseDatabase.instance.ref('path')await reference.update({'x':'value'});
var snapshot =await reference.get();
expect(snapshot.value, {'x':'value'});
await reference.update({'x':null}); // should remove the entry
snapshot =await reference.get();
expect(snapshot.value, null); // this fails, actual: {'x':null}
});
The text was updated successfully, but these errors were encountered:
Simsen3142
changed the title
Calling MockDatabaseReference.update with null values adds null values to database instead deleting it
Calling MockDatabaseReference.update with null values adds null values to database instead of deleting the entry
Nov 24, 2023
Description:
when setting a value of
DatabaseReference
tonull
usingupdate
,FirebaseDatabase
removes this value from the database.MockDatabaseReference.update
inserts a null value insteadHow to reproduce:
The text was updated successfully, but these errors were encountered: