简体   繁体   中英

How to pass enum in Mutation using graphql in Flutter?

mutation{addOrder (create:{ offerId:2,paymentType:PaymentType!}) { id } }

Here is my code .here PaymentType is a enum.

since you have the PaymentType you can use it normally , example:

PaymentType =enum {"visa" ,"masterCard"} 

you have to passe the variable in you flutter end which corresponds to one of these two anyother value will generate an error the variables should be something like this :

variables :{offerId:2,paymentType:"visa"}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM