Skip to content

Commit

Permalink
fix: individually suppress "deprecated_member_use_from_same_package" …
Browse files Browse the repository at this point in the history
…only

This is because there is no way to do at analysis_option.yaml
  • Loading branch information
mainawycliffe committed Nov 11, 2019
1 parent 25f3c85 commit 9216976
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
6 changes: 0 additions & 6 deletions packages/graphql/analysis_options.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions packages/graphql/lib/src/core/query_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class BaseOptions extends RawOperationData {
this.context,
this.optimisticResult,
}) : super(
// ignore: deprecated_member_use_from_same_package
document: document,
documentNode: documentNode,
variables: variables,
Expand Down Expand Up @@ -114,6 +115,7 @@ class QueryOptions extends BaseOptions {
Map<String, dynamic> context,
}) : super(
policies: Policies(fetch: fetchPolicy, error: errorPolicy),
// ignore: deprecated_member_use_from_same_package
document: document,
documentNode: documentNode,
variables: variables,
Expand Down Expand Up @@ -145,6 +147,7 @@ class MutationOptions extends BaseOptions {
this.onError,
}) : super(
policies: Policies(fetch: fetchPolicy, error: errorPolicy),
// ignore: deprecated_member_use_from_same_package
document: document,
documentNode: documentNode,
variables: variables,
Expand Down Expand Up @@ -258,6 +261,7 @@ class WatchQueryOptions extends QueryOptions {
this.eagerlyFetchResults,
Map<String, dynamic> context,
}) : super(
// ignore: deprecated_member_use_from_same_package
document: document,
documentNode: documentNode,
variables: variables,
Expand Down Expand Up @@ -320,11 +324,13 @@ class FetchMoreOptions {
this.variables = const <String, dynamic>{},
@required this.updateQuery,
}) : assert(
// ignore: deprecated_member_use_from_same_package
_mutuallyExclusive(document, documentNode),
'"document" or "documentNode" options are mutually exclusive.',
),
assert(updateQuery != null),
this.documentNode =
// ignore: deprecated_member_use_from_same_package
documentNode ?? document != null ? parseString(document) : null;

DocumentNode documentNode;
Expand Down
6 changes: 6 additions & 0 deletions packages/graphql/lib/src/core/raw_operation_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ class RawOperationData {
Map<String, dynamic> variables,
String operationName,
}) : assert(
// ignore: deprecated_member_use_from_same_package
document != null || documentNode != null,
'Either a "document" or "documentNode" option is required. '
'You must specify your GraphQL document in the query options.',
),
assert(
// ignore: deprecated_member_use_from_same_package
(document != null && documentNode == null) ||
// ignore: deprecated_member_use_from_same_package
(document == null && documentNode != null),
'"document" or "documentNode" options are mutually exclusive.',
),
// ignore: deprecated_member_use_from_same_package
documentNode = documentNode ?? parseString(document),
_operationName = operationName,
variables = SplayTreeMap<String, dynamic>.of(
Expand Down Expand Up @@ -87,6 +91,8 @@ class RawOperationData {
return object.toJson();
});

// TODO: document is being depracated, find ways for generating key
// ignore: deprecated_member_use_from_same_package
return '$document|$encodedVariables|$_identifier';
}
}
9 changes: 6 additions & 3 deletions packages/graphql/lib/src/link/link.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:async';

import 'package:equatable/equatable.dart';
import 'package:graphql/src/link/fetch_result.dart';
import 'package:graphql/src/link/operation.dart';

Expand All @@ -27,7 +26,7 @@ Link _concat(
});
}

class Link extends Equatable {
class Link {
Link({this.request});

RequestHandler request;
Expand All @@ -40,7 +39,11 @@ class Link extends Equatable {
Link concat(Link next) => _concat(this, next);

@override
List<Object> get props => null;
bool operator ==(other) =>
identical(this, other) || other is Link && other.request == request;

@override
int get hashCode => request.hashCode;
}

Stream<FetchResult> execute({Link link, Operation operation}) =>
Expand Down
1 change: 1 addition & 0 deletions packages/graphql/lib/src/link/operation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Operation extends RawOperationData {
this.extensions,
String operationName,
}) : super(
// ignore: deprecated_member_use_from_same_package
document: document,
documentNode: documentNode,
variables: variables,
Expand Down

0 comments on commit 9216976

Please # to comment.