graphql_parser2 2.0.0 copy "graphql_parser2: ^2.0.0" to clipboard
graphql_parser2: ^2.0.0 copied to clipboard

outdated

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

graphql_parser2 #

version Null Safety Gitter

License

Parses GraphQL queries and schemas.

This library is merely a parser/visitor. Any sort of actual GraphQL API functionality must be implemented by you, or by a third-party package.

Angel3 framework users should consider package:angel3_graphql as a dead-simple way to add GraphQL functionality to their servers.

Installation #

Add graphql_parser2 as a dependency in your pubspec.yaml file:

dependencies:
  graphql_parser2: ^2.0.0

Usage #

The AST featured in this library was originally directly based off this ANTLR4 grammar created by Joseph T. McBride: https://github.com/antlr/grammars-v4/blob/master/graphql/GraphQL.g4

It has since been updated to reflect upon the grammar in the official GraphQL specification ( June 2018).

import 'package:graphql_parser2/graphql_parser2.dart';

doSomething(String text) {
  var tokens = scan(text);
  var parser = Parser(tokens);
  
  if (parser.errors.isNotEmpty) {
    // Handle errors...
  }
  
  // Parse the GraphQL document using recursive descent
  var doc = parser.parseDocument();
  
  // Do something with the parsed GraphQL document...
}
0
likes
0
pub points
41%
popularity

Publisher

verified publisherdukefirehawk.com

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

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

charcode, source_span, string_scanner

More

Packages that depend on graphql_parser2