Giter VIP home page Giter VIP logo

Comments (5)

mike-gallego avatar mike-gallego commented on May 20, 2024

Temporary workaround was to make the placeholder a map instead and in the transaction add the map to the existing map (placeholder).

await Firestore.instance.collection('users').document(user.uid).setData({ 'ban_list': new Map(), });

await tx.update(postRef, <String, dynamic>{ 'ban_list': postSnapshot.data['ban_list']..addAll({listOfDocs[index]['id'] : listOfDocs[index]['id']}) });

from flutterfire.

collinjackson avatar collinjackson commented on May 20, 2024

I'm confused by your original code snippet, since it looks like you're using the return value of .add (void) as a value in a Map. I'm not sure if the issue is in the plugin, the native SDK, or your code, but if you want to write an integration test for it I'd be happy to investigate further.

from flutterfire.

NoamDev avatar NoamDev commented on May 20, 2024

try this:
await tx.update(postRef, <String, dynamic>{ 'ban_list': postSnapshot.data['ban_list'].toList() .add(listOfDocs[index]['id']) });
calling toList will make a new growable list from the fixed-length list, which will allow you to add new elements to it.

from flutterfire.

NoamDev avatar NoamDev commented on May 20, 2024

@mikeyyg96 did it work for you?

from flutterfire.

iapicca avatar iapicca commented on May 20, 2024

Hi @mikeyyg96
I'm closing this issue for inactivity.
If you disagree please write in the comments
and I will reopen it.
Thank you

from flutterfire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.