simple_gql 1.2.0 copy "simple_gql: ^1.2.0" to clipboard
simple_gql: ^1.2.0 copied to clipboard

A minimal library to do GraphQL queries and mutations (subscriptions not handled)

example/simple_gql_example.dart

import 'package:simple_gql/simple_gql.dart';

void main() async {
  try {
    final response = await GQLClient(
      'https://graphqlzero.almansi.me/api',
    ).query(
      query: r'''
        query todos($options: PageQueryOptions) {
          todos(options: $options) {
            data {
              id
              title
              completed
              user {
                id
                username
                website
              }
            }
          }
        }
      ''',
      variables: {
        'options': {
          'paginate': {
            'page': 0,
            'limit': 1,
          },
        },
      },
    );
    print('Yay, success ! :D');
    print(response);
  } on GQLError catch (e) {
    print('Ouch ! :(');
    print(e);
  } catch (e) {
    print('Probably a network error');
    print(e);
  }
}
8
likes
120
pub points
27%
popularity

Publisher

unverified uploader

A minimal library to do GraphQL queries and mutations (subscriptions not handled)

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

http, meta

More

Packages that depend on simple_gql