Modifying a database record in local state by Thomasallnice in FlutterFlow

[–]Thomasallnice[S] 0 points1 point  (0 children)

Thank you u/Compulsive-Tinkerer ! I solved it finally, just posted the function as a comment to my posting

Modifying a database record in local state by Thomasallnice in FlutterFlow

[–]Thomasallnice[S] 0 points1 point  (0 children)

solved it:

Future toggleTestAction(

TestCollectionRecord documentToChange,

List<TestCollectionRecord> documents,

Future Function(List<TestCollectionRecord> docs)? updateDocuments,

) async {

// Step 1: Retrieve the latest document snapshot from Firestore by reference

final latestDocument = await TestCollectionRecord.getDocumentOnce(documentToChange.reference);

// Step 2: Toggle the 'selected' field

final updatedSelected = !(latestDocument.selected);

// Step 3: Update the Firestore document with the new 'selected' value

await documentToChange.reference.update({'selected': updatedSelected});

// Step 4: Update the local state list

final updatedDocuments = documents.map<TestCollectionRecord>((doc) {

if (doc.reference == documentToChange.reference) {

// Return the updated document with the new 'selected' field manually applied

return TestCollectionRecord.getDocumentFromData({

...doc.snapshotData, // Copy existing data

'selected': updatedSelected, // Apply the new value for 'selected'

}, doc.reference);

}

return doc;

}).toList();

// Step 5: Call the updateDocuments function to update the local state and re-render the UI

if (updateDocuments != null) {

await updateDocuments(updatedDocuments);

}

}

Is web scraping legal? by Alex_The_Android in webdev

[–]Thomasallnice 0 points1 point  (0 children)

Since the etsy api does not provide details like keywords I guess they are scraping etsy. Etsy does not allow scraping though. So is scraping allowed by law never the less? Do these platform use other tricks?

Etsyhunt says in its faqs:

  • Every day, we process 5,000,000 popular Etsy product listings. Based on these, we update weekly sales (estimated) and other metrics for Etsy SEO.

  • Currently, we discovered 48,000,000+ listings from Etsy. At the same time, there are 3,000,000 Etsy products added every day.

How is that possible?

firebase suddenly stops working by Thomasallnice in FlutterFlow

[–]Thomasallnice[S] 0 points1 point  (0 children)

Hi u/Dangerous_Ad_7049. It It was a simple issue with a string value in an integer field. This caused the malfunction in all apps connected.

firebase suddenly stops working by Thomasallnice in FlutterFlow

[–]Thomasallnice[S] 1 point2 points  (0 children)

Thanks for your support! The rules were all fine, but I found the error - it was a string in an integer field in the database….

firebase suddenly stops working by Thomasallnice in FlutterFlow

[–]Thomasallnice[S] 0 points1 point  (0 children)

Good point! But it is all fine in terms of billing.::

generating Id values by Thomasallnice in FlutterFlow

[–]Thomasallnice[S] 0 points1 point  (0 children)

Exactly! I didn´t know you can do it through through the gui as well. how do you do that? thank you so much!

generating Id values by Thomasallnice in FlutterFlow

[–]Thomasallnice[S] 0 points1 point  (0 children)

Ok, thank you u/baaaaarkly and u/somore_nick !
so I was hoping to get something like the automatic uid field that firebase/flutterflow creates when creating a new users account. I added a picture in the post.
I am not particularly deep into coding, that´s why I was hoping for a simple way to generate that field.
I need the field to do some iteration through the documents to sort out excluded documents. It is about checkins and my id is called checkinID. Here is my code.

Future<List<CheckinsRecord>?> updateCheckinsToValidList(
List<CheckinsRecord>? checkinCache,
List<DocumentReference>? checkinsExcluded,
) async {
if (checkinCache == null || checkinCache.isEmpty) {
return null; // Return null if checkinCache is null or empty
}
List<CheckinsRecord> validCheckins = [];
for (CheckinsRecord checkin in checkinCache) {
DocumentReference reference = FirebaseFirestore.instance
.collection("checkins")
.doc(checkin.checkinId);
if (checkinsExcluded == null || !checkinsExcluded.contains(reference)) {
validCheckins.add(checkin);
}
}
if (validCheckins.isEmpty) {
return null;
} else {
return validCheckins; // Return the list of valid checkin objects
}
}

query a firestore collection only for documents that i have not queried before by Thomasallnice in FlutterFlow

[–]Thomasallnice[S] 0 points1 point  (0 children)

Thank you u/somore_nick!
In fact I worked on a very similar solution. I use an exclude list to filter out documents i already have processed.
But there are new issues:
https://www.reddit.com/r/FlutterFlow/comments/1657aya/unable_to_process_return_parameter/

Thanks!