'StreamProvider with Firebase RTDB
I'm trying to utilize StreamProvider to see if there are changes in the friends of an user (i.e. if someone added/deleted the user). My current stream code is attached below. However I'm running into the issue A value of type 'Future<List<String?>>' can't be returned from the method 'getMyFriends' because it has a return type of 'Stream<List<String>>'
Essentially for this stream, I only want to monitor the keys (in this case the userIDs of the other users) and not the value of the friends so the stream should be returning a list of keys. Any suggestions is appreciated!
Stream<List<String>> getMyFriends(String myUserID) {
return rtdb
.child('friends')
.child(myUserID)
.onValue
.map((event) => event.snapshot)
.map((data) => data.key).toList();
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

