File tree Expand file tree Collapse file tree 6 files changed +29
-2
lines changed
graphql_flutter/example/lib Expand file tree Collapse file tree 6 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 11import 'dart:async' ;
22
33import 'package:graphql/src/utilities/response.dart' ;
4+ import 'package:graphql_common/graphql_common.dart' ;
45import 'package:meta/meta.dart' ;
56import 'package:collection/collection.dart' ;
67
@@ -26,6 +27,7 @@ class QueryManager {
2627 QueryManager ({
2728 required this .link,
2829 required this .cache,
30+ this .tracer,
2931 this .alwaysRebroadcast = false ,
3032 }) {
3133 scheduler = QueryScheduler (
@@ -50,6 +52,10 @@ class QueryManager {
5052 /// prevents rebroadcasting for some intensive bulk operation like [refetchSafeQueries]
5153 bool rebroadcastLocked = false ;
5254
55+ /// Custom Tracer specified by the user to trace the library
56+ /// if the user need it.
57+ final Tracer ? tracer;
58+
5359 ObservableQuery <TParsed > watchQuery <TParsed >(
5460 WatchQueryOptions <TParsed > options) {
5561 final ObservableQuery <TParsed > observableQuery = ObservableQuery <TParsed >(
Original file line number Diff line number Diff line change 11import 'package:meta/meta.dart' ;
22import 'dart:async' ;
3-
43import 'package:graphql/src/core/core.dart' ;
54import 'package:graphql/src/cache/cache.dart' ;
6-
75import 'package:graphql/src/core/fetch_more.dart' ;
6+ import 'package:graphql_common/graphql_common.dart' ;
87
98/// Universal GraphQL Client with configurable caching and [link][] system.
109/// modelled after the [`apollo-client`][ac] .
@@ -24,12 +23,14 @@ class GraphQLClient implements GraphQLDataProxy {
2423 GraphQLClient ({
2524 required this .link,
2625 required this .cache,
26+ this .tracer,
2727 DefaultPolicies ? defaultPolicies,
2828 bool alwaysRebroadcast = false ,
2929 }) : defaultPolicies = defaultPolicies ?? DefaultPolicies (),
3030 queryManager = QueryManager (
3131 link: link,
3232 cache: cache,
33+ tracer: tracer,
3334 alwaysRebroadcast: alwaysRebroadcast,
3435 );
3536
@@ -44,11 +45,16 @@ class GraphQLClient implements GraphQLDataProxy {
4445
4546 late final QueryManager queryManager;
4647
48+ /// Custom Tracer specified by the user to trace the library
49+ /// if the user need it.
50+ final Tracer ? tracer;
51+
4752 /// Create a copy of the client with the provided information.
4853 GraphQLClient copyWith (
4954 {Link ? link,
5055 GraphQLCache ? cache,
5156 DefaultPolicies ? defaultPolicies,
57+ Tracer ? tracer,
5258 bool ? alwaysRebroadcast}) {
5359 return GraphQLClient (
5460 link: link ?? this .link,
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import 'package:gql_exec/gql_exec.dart';
77import 'package:graphql/src/core/query_options.dart' show WithType;
88import 'package:graphql/src/links/gql_links.dart' ;
99import 'package:graphql/src/utilities/platform.dart' ;
10+ import 'package:graphql_common/graphql_common.dart' ;
1011import 'package:meta/meta.dart' ;
1112import 'package:rxdart/rxdart.dart' ;
1213import 'package:stream_channel/stream_channel.dart' ;
@@ -48,8 +49,13 @@ class SocketClientConfig {
4849 this .initialPayload,
4950 this .headers,
5051 this .connectFn,
52+ this .tracer,
5153 });
5254
55+ /// Custom Tracer specified by the user to trace the library
56+ /// if the user need it.
57+ final Tracer ? tracer;
58+
5359 /// Serializer used to serialize request
5460 final RequestSerializer serializer;
5561
Original file line number Diff line number Diff line change 11import 'package:gql_exec/gql_exec.dart' ;
22import 'package:gql_link/gql_link.dart' ;
3+ import 'package:graphql_common/graphql_common.dart' ;
34
45import './websocket_client.dart' ;
56
@@ -17,6 +18,7 @@ class WebSocketLink extends Link {
1718 this .url, {
1819 this .config = const SocketClientConfig (),
1920 this .subProtocol = GraphQLProtocol .graphqlWs,
21+ this .tracer,
2022 });
2123
2224 final String url;
@@ -26,6 +28,10 @@ class WebSocketLink extends Link {
2628 // cannot be final because we're changing the instance upon a header change.
2729 SocketClient ? _socketClient;
2830
31+ /// Custom Tracer specified by the user to trace the library
32+ /// if the user need it.
33+ final Tracer ? tracer;
34+
2935 @override
3036 Stream <Response > request (Request request, [forward]) async * {
3137 if (_socketClient == null ) {
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ dependencies:
2121 stream_channel : ^2.1.0
2222 rxdart : ^0.27.1
2323 uuid : ^3.0.1
24+ graphql_common :
25+ path : ../graphql_common
2426
2527dev_dependencies :
2628 async : ^2.5.0
Original file line number Diff line number Diff line change 44
55// ignore_for_file: directives_ordering
66// ignore_for_file: lines_longer_than_80_chars
7+ // ignore_for_file: depend_on_referenced_packages
78
89import 'package:connectivity_plus_web/connectivity_plus_web.dart' ;
910
You can’t perform that action at this time.
0 commit comments