I am trying to set the values of a custom document record object in Flutterflow. I created a collection and a Location document type. I want to pass a list of these Location Documents to the GoogleMaps component of Flutterflow and it only allows to attach data for markers when you use documents. So I can't use a list custom data types for it.
I had this code already working with the custom data type, but now I need to rewrite it to make it work with the document records.
How to set values(name, description, latLng) to the LocationRecord object? I don't need to save them to a database. I just need these objects to trick the Google Map component, since my location data is coming from an API.
List<LocationRecord> createLocationRecordsFromJson(dynamic jsonMarkers) {
/// MODIFY CODE ONLY BELOW THIS LINE
List<LocationRecord> locations = [];
dynamic markers = jsonMarkers['markers'];
markers.forEach((element) {
LocationRecord location = new LocationRecord();
/// something like location.set('name', element['title']);
locations.add(location);
});
return locations;
/// MODIFY CODE ONLY ABOVE THIS LINE
}
It's not possible in Flutterflow. Custom functions are not async, if you want to use Firestore, you need to use custom actions or custom widgets.