galileo_graphql_parser 3.0.0 copy "galileo_graphql_parser: ^3.0.0" to clipboard
galileo_graphql_parser: ^3.0.0 copied to clipboard

Parses GraphQL queries and schemas. Also includes classes for the GraphQL AST.

example/example.dart

import 'package:galileo_graphql_parser/galileo_graphql_parser.dart';

final String text = '''
{
  project(name: "GraphQL") {
    tagline
  }
}
  '''
    .trim();

main() {
  var tokens = scan(text);
  var parser = Parser(tokens);
  var doc = parser.parseDocument();

  var operation = doc.definitions.first as OperationDefinitionContext;

  var projectField = operation.selectionSet.selections.first.field;
  print(projectField.fieldName.name); // project
  print(projectField.arguments.first.name); // name
  print(projectField.arguments.first.value); // GraphQL

  var taglineField = projectField.selectionSet.selections.first.field;
  print(taglineField.fieldName.name); // tagline
}
0
likes
40
pub points
0%
popularity

Publisher

verified publishergalileodart.com

Parses GraphQL queries and schemas. Also includes classes for the GraphQL AST.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

charcode, source_span, string_scanner

More

Packages that depend on galileo_graphql_parser