getFriendList method

Future<List?> getFriendList(
  1. dynamic userId
)

Implementation

Future<List<dynamic>?> getFriendList(var userId) async {
  List<dynamic>? friendList;

  FirebaseFirestore.instance
      .collection(getDocName())
      .doc(userId)
      .get()
      .then((DocumentSnapshot documentSnapshot) {
    if (documentSnapshot.exists) {
      friendList = documentSnapshot.get('friends');
      return friendList;
    } else {
      return null;
      print('Document does not exist on the database');
    }
  });

  return friendList;
}