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 request( Request request, [ NextLink? forward, ]) { Stream response = forward!(request).map((Response fetchResult) { final ioStreamedResponse = fetchResult.context.entry(); if (kDebugMode) { print("Request: ${request.toString()}"); print("Response:${ioStreamedResponse?.toString() ?? "null"}"); } return fetchResult; }).handleError((error) { throw error; }); return response; } LoggerLink(); } final _loggerLink = LoggerLink();