Skip to content
Advertisement

How to send multiline string from graphQL from flutter?

I am trying put multiline support in one of the comment section of app and it is not accepting it.

the input which i put is

JavaScript

and it is showing this error

this is the error i am getting while putting the above input in the textfield

And this is the code i am writing for the inputfield

JavaScript

The problem is with updating the graphQL query and initializing it with String block

JavaScript

Advertisement

Answer

I presume you are using flutter_graphql. It is bad practice to generate mutation strings using interpolation. You should use graphql variables for sending data with mutations (And, there is no problem in sending a multi-line string).

Sample:

JavaScript

The type of $postId & $comment should be same as that of in your graphql schema. I have declared them as String on the very first line.

You can find the documentation of the same here

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement