Is it possible to convert print data into a string in order for Firestore integration?


I would like to know whether or not it is possible to utilise the print(); command in flutter to create a String in order to link said data to a Firestore database.

I am creating a customer satisfaction application in which the customer would press a button on the screen and said button would then omit a message to the database corresponding the reaction the customer selected.

Only issue is: I have not found a way to link onPressed:in way that it can omit such data to a server or locally.

Here is a brief bit of code to somewhat witness what I am trying to achieve:

            child: ElevatedButton(
              style: ElevatedButton.styleFrom(
                onPrimary: Colors.cyanAccent,
                primary: Colors.deepPurple,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(55.0),
              onPressed: () async {
                print('Good Chosen');
                // Close the screen and return "Good Chosen" as the result.
                Navigator.pop(context, 'Good Chosen');
              child: Image.asset('assets/good pixel.png'),


Have you considered writing the Good Chosen string directly to firestore?

Instead of / additionally to your print statements, you could write

     .set({'type': 'good_chosen', 'timestamp':,}, SetOptions(merge: true));

Answered By – Tiago Santos

Answer Checked By – Gilberto Lyons (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *