I am building a desktop application for Windows using Flutter. I am trying to retrieve all of the documents IDs from a collection in FireStore using the package
'''
/// to save return id only
List<String> ids = [];
/// first store return data in List<dynamic>
List<dynamic> list = [
"/users/1dfU7emalRX89z5zlfX0AQLqehq1 {'url': '', 'name': '', 'height':'' , 'weight': '',}",
"/users/JF6PMb2q9Igsb56jgPRs1DGzJ0d2{url: '', 'name': '', 'height':'' , 'weight': '',}"
];
/// forEach element in list convert it to string
list.forEach((element) {
/// it will return part of string as '/users/1dfU7emalRX89z5zlfX0AQLqehq1 '
final String firstPartString = element.toString().split('{').first;
/// split new string by / and it the last item (it is id)
final String id = firstPartString.split('/').last;
/// adding id to ids list (trim to remove any prefix of suffix space)
ids.add(id.trim());
});
print(ids);
'''