How to use _like with '%' in a graphql string?

Viewed 320

I'm using flutter with graphql/client library. I'm trying to create a string for a gql query that has a where condition:

const getUsers = """
query getUsers(\$nameToSearch: String!) {
   users(where: {name: {_ilike: %\$nameToSearch%}}) {
      id
      name
   }
}
""";

the problem is that I don't know how to insert the '%' symbol in that string... the example is wrong and I tried all the combinations. Online I found only basic examples that doesn't use the '%' symbol

What is the correct syntax?

1 Answers

just store you value inside another variable and then use that variable with ${variable} inside the graphql query it will help you

Related