graphql_fragment_builder 1.0.0 copy "graphql_fragment_builder: ^1.0.0" to clipboard
graphql_fragment_builder: ^1.0.0 copied to clipboard

A flexible and type-safe GraphQL fragment builder for Dart and Flutter applications.

example/example.dart

import 'package:graphql_fragment_builder/graphql_fragment_builder.dart';

class BookDetailsFragment extends QueryFragment with SimpleQueryFragment {
  @override
  String get objectName => 'bookDetails';

  @override
  List<String> get fields => [
        'title',
        'author',
        'publicationYear',
        'genre',
      ];
}

void main() {
  final query = GraphQLQueryBuilder(
    name: 'getBooksByAuthor',
    parameters: const [
      QueryParameter('authorName', 'Jane Austen'),
      QueryParameter('limit', 5),
    ],
    fragments: [BookDetailsFragment()],
  );

  print('Query:');
  print(query.buildQuery());
  print('\nVariables:');
  print('${query.variables}');
}
3
likes
160
pub points
0%
popularity

Publisher

verified publishergabrimatic.info

A flexible and type-safe GraphQL fragment builder for Dart and Flutter applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on graphql_fragment_builder