Skip to content

Commit

Permalink
Add fragments param for gql
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethnym committed Mar 13, 2021
1 parent 9160a95 commit d406ede
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/graphql/lib/src/utilities/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ Map<String, dynamic> deeplyMergeLeft(
/// If you want to provide your own document parser or builder,
/// keep in mind that default cache normalization depends heavily on `__typename`s,
/// So you should probably include an [AddTypenameVistor] [transform]
DocumentNode gql(String document) => transform(
DocumentNode gql(String document, {List<DocumentNode> fragments = const []}) =>
transform(
parseString(document),
[AddTypenameVisitor()],
);
)..definitions.addAll(
fragments.expand((fragment) => fragment.definitions),
);

/// Converts [MultipartFile]s to a string representation containing hashCode. Default argument to [variableSanitizer]
Object sanitizeFilesForCache(dynamic object) {
Expand Down

0 comments on commit d406ede

Please sign in to comment.