built_graphql 1.0.1 copy "built_graphql: ^1.0.1" to clipboard
built_graphql: ^1.0.1 copied to clipboard

Using built_value to deserialize GraphQL JSON responses. The package provides generic classes to deal with the fix format of the GraphQL response and errors.

example/main.dart

import 'dart:convert';
import 'package:built_graphql/built_graphql.dart';

import 'hero.dart';
import 'serializers.dart';

void main() {
  final String jsonStr = '''
    {
      "data": {
        "hero": {
          "name": "R2-D2",
          "heroFriends": [
            {
              "id": "1000",
              "name": "Luke Skywalker"
            },
            {
              "id": "1002",
              "name": null
            },
            {
              "id": "1003",
              "name": "Leia Organa"
            }
          ]
        }
      }
    }
    ''';
  final GraphQLResponse<Hero> response = standardSerializers.deserialize(
      json.decode(jsonStr),
      specifiedType: GraphQLResponse.createFullTypeFor(Hero));

  print(response);
}
2
likes
40
pub points
0%
popularity

Publisher

unverified uploader

Using built_value to deserialize GraphQL JSON responses. The package provides generic classes to deal with the fix format of the GraphQL response and errors.

Repository

License

BSD-3-Clause (LICENSE)

Dependencies

built_collection, built_value

More

Packages that depend on built_graphql