I'm trying to retrieve user data from a Firebase Collection.
This is the method I wrote to get the data:
static String getUserData(creatorId, keyword) { var documentName = Firestore.instance .collection('users') .document(creatorId) .get() .then((DocumentSnapshot) { String data = (DocumentSnapshot.data['$keyword'].toString()); return data; }); } The method only returns null. If I print the String in the Method it works. How can I return the String?
Help would be greatly appreciated.
Cheers Paul

documentNameto a future and returns. This function must return a Future<String> and the caller must await it.