graphql_query_compress

Last updated:

0 purchases

graphql_query_compress Image
graphql_query_compress Images
Add to Cart

Description:

graphql query compress

This package eliminates unnecessary characters from a GraphQL query, saving several bytes on requests.
final compressedQuery = compressGraphqlQuery(query);
copied to clipboard
Using it with gql_dio_link, gql_http_link or graphql #
GQL will serialize your query in a human-readable format after parse it to DocumentNodes. Therefore, we can't simple compress it before using the GQL parser.
To overcome this, we need to replace GQL RequestSerializer by RequestSerializerWithCompressor
return GraphQLClient(
cache: GraphQLCache(store: null),
link: HttpLink(
_apiUrl,
serializer: const RequestSerializerWithCompressor(),
),
);
copied to clipboard
The same applies to DioLink:
final link = DioLink(
_apiUrl,
client: Dio(),
useGETForQueries: true,
serializer: const RequestSerializerWithCompressor(),
);
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.