graphql_client icon indicating copy to clipboard operation
graphql_client copied to clipboard

when value of resolved filed is List type, error throwed

Open haoliangwu opened this issue 7 years ago • 0 comments

when value of resolved field is List type, met error:

E/flutter (28080): type 'List<dynamic>' is not a subtype of type 'Map<dynamic, dynamic>'
E/flutter (28080): #0      GQLClient._resolve (package:graphql_client/src/client.dart:168:31)
E/flutter (28080): #1      GQLClient._resolveFields (package:graphql_client/src/client.dart:122:9)
E/flutter (28080): #2      GQLClient._resolveQuery (package:graphql_client/src/client.dart:115:5)
E/flutter (28080): #3      GQLClient.execute (package:graphql_client/src/client.dart:70:7)
...

my GraphQL query is:

query ActivitiesQuery {
   activities {
      id
   }
 }

and the http response body is:

{
  "data": {
    "activities": [
      {
        "id": "cjjb31t5rdjp701200999b2r1"
      }
    ]
  }
}

I noticed there is the ScalarCollection abstract class(mixin) and maybe it was designed for GraphQL pagination purpose.

Am I missing something how to handle value of List type field that is not follow GraphQL pagination format ? thx a lot.

haoliangwu avatar Jul 08 '18 12:07 haoliangwu