royalcat
0d7aac068c
All checks were successful
docker / build-docker (linux/amd64) (push) Successful in 1m39s
docker / build-docker (linux/386) (push) Successful in 1m46s
docker / build-docker (linux/arm64/v8) (push) Successful in 8m18s
docker / build-docker (linux/arm64) (push) Successful in 8m29s
docker / build-docker (linux/arm/v7) (push) Successful in 8m49s
47 lines
1.2 KiB
Dart
47 lines
1.2 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:graphql/client.dart';
|
|
|
|
// final client = GraphQLClient(
|
|
// link: _loggerLink.concat(HttpLink("http://localhost:4444/graphql")),
|
|
// cache: GraphQLCache(store: null),
|
|
// defaultPolicies: DefaultPolicies(
|
|
// query: Policies(
|
|
// fetch: FetchPolicy.noCache,
|
|
// ),
|
|
// ),
|
|
// );
|
|
|
|
final client = GraphQLClient(
|
|
link: HttpLink("http://192.168.217.150:4444/graphql"),
|
|
cache: GraphQLCache(store: null),
|
|
defaultPolicies: DefaultPolicies(
|
|
query: Policies(
|
|
fetch: FetchPolicy.noCache,
|
|
),
|
|
),
|
|
);
|
|
|
|
class LoggerLink extends Link {
|
|
@override
|
|
Stream<Response> request(
|
|
Request request, [
|
|
NextLink? forward,
|
|
]) {
|
|
Stream<Response> response = forward!(request).map((Response fetchResult) {
|
|
final ioStreamedResponse = fetchResult.context.entry<HttpLinkResponseContext>();
|
|
if (kDebugMode) {
|
|
print("Request: ${request.toString()}");
|
|
print("Response:${ioStreamedResponse?.toString() ?? "null"}");
|
|
}
|
|
return fetchResult;
|
|
}).handleError((error) {
|
|
throw error;
|
|
});
|
|
|
|
return response;
|
|
}
|
|
|
|
LoggerLink();
|
|
}
|
|
|
|
final _loggerLink = LoggerLink();
|