i have something like this in firebase
songList {
songName1: "HelloWorld",
songName2: "AnotherSong",
songName3: "andTheLastOne"
}
i am trying to delete key value songName2 but my code is not given error and not working.
Future<Either<ServerError, bool>> deleteNewFollow(String id) async {
try {
// Note you can use this format but i refer the other option...
// await ref.update({
// 'reqfellowers': FieldValue.arrayRemove([{}.remove(id)])
// });
await firestore
.collection("users")
.doc(auth.currentUser!.uid)
.update({'reqfellowers.$id': FieldValue.delete()});
await firestore
.collection("users")
.doc(id)
.update({'sentRequest.${auth.currentUser!.uid}': FieldValue.delete()});
return right(true);
} catch (e) {
print("=====> $e");
return left(ServerError(e.toString()));
}
}
here is the image if maps