【问题标题】:Upload photo graphql by Flutter通过 Flutter 上传照片 graphql
【发布时间】:2020-05-29 05:55:05
【问题描述】:

我使用https://pub.dev/packages/graphql_flutter 包上传照片。它运行良好,但在升级软件包后,它崩溃了。错误

I/flutter (12390): GraphQL Errors:
I/flutter (12390): Variable "$uploadPhoto" got invalid value {}; 
Expected type Upload. Upload value invalid.: Undefined location 

另外,也许是后端的问题 Node js code

或者可能是 Flutter 方面的问题 Flutter code 我用https://pub.dev/packages/multi_image_picker

变异

 mutation (
       $uploadPhoto:Upload 
       $childServiceIds: [String!]
       $executors: [String!]
       $institutionId: String!
       $description:String!
       $price: Float!
       $name:String!
      ){
      createService(
        institutionId: $institutionId
        description: $description
        iconImage: $uploadPhoto
        name: $name
        price: $price
        token:""
        childServiceIds: $childServiceIds
        executors: $executors
      ){
        services{ 
          _id
                    name
            price
            description
            childServiceIds
            iconLogoUrl
        }
    }
      }

【问题讨论】:

    标签: node.js express flutter graphql apollo-server


    【解决方案1】:

    你没有空检查。

    可能 uploadPhoto 为 null,而您的类型不匹配。

    PS 分享方法 dart code in text not in picture.

    【讨论】:

    • 感谢您对代码的建议。我检查了 uploadPhoto 不为空。
    猜你喜欢
    • 2020-05-21
    • 1970-01-01
    • 2021-02-06
    • 2010-12-10
    • 1970-01-01
    • 2012-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多