Skip to content

Commit

Permalink
fix(graphql): default-yet-overrideable variable
Browse files Browse the repository at this point in the history
  • Loading branch information
micimize committed Jun 1, 2020
1 parent 3246394 commit 6ba687e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/graphql/lib/src/core/_base_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import 'package:graphql/src/core/policies.dart';
abstract class BaseOptions extends MutableDataClass {
BaseOptions({
@required this.document,
this.variables = const {},
this.operationName,
this.variables,
Context context,
FetchPolicy fetchPolicy,
ErrorPolicy errorPolicy,
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/lib/src/core/mutation_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MutationOptions extends BaseOptions {
MutationOptions({
@required DocumentNode document,
String operationName,
Map<String, dynamic> variables,
Map<String, dynamic> variables = const {},
FetchPolicy fetchPolicy,
ErrorPolicy errorPolicy,
Context context,
Expand Down
8 changes: 4 additions & 4 deletions packages/graphql/lib/src/core/query_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class QueryOptions extends BaseOptions {
QueryOptions({
@required DocumentNode document,
String operationName,
Map<String, dynamic> variables,
Map<String, dynamic> variables = const {},
FetchPolicy fetchPolicy,
ErrorPolicy errorPolicy,
Object optimisticResult,
Expand Down Expand Up @@ -52,7 +52,7 @@ class SubscriptionOptions extends BaseOptions {
SubscriptionOptions({
@required DocumentNode document,
String operationName,
Map<String, dynamic> variables,
Map<String, dynamic> variables = const {},
FetchPolicy fetchPolicy,
ErrorPolicy errorPolicy,
Object optimisticResult,
Expand All @@ -75,7 +75,7 @@ class WatchQueryOptions extends QueryOptions {
WatchQueryOptions({
@required DocumentNode document,
String operationName,
Map<String, dynamic> variables,
Map<String, dynamic> variables = const {},
FetchPolicy fetchPolicy,
ErrorPolicy errorPolicy,
Object optimisticResult,
Expand Down Expand Up @@ -124,7 +124,7 @@ class WatchQueryOptions extends QueryOptions {
class FetchMoreOptions {
FetchMoreOptions({
this.document,
this.variables = const <String, dynamic>{},
this.variables = const {},
@required this.updateQuery,
}) : assert(updateQuery != null);

Expand Down
14 changes: 6 additions & 8 deletions packages/graphql/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ name: graphql
description:
A stand-alone GraphQL client for Dart, bringing all the features from
a modern GraphQL client to one easy to use package.
version: 3.1.0-beta.4
authors:
- Eus Dima <[email protected]>
- Zino Hofmann <[email protected]>
- Michael Joseph Rosenthal <[email protected]>
- TruongSinh Tran-Nguyen <[email protected]>
version: 4.0.0-alpha.0
homepage: https://github.com/zino-app/graphql-flutter/tree/master/packages/graphql
dependencies:
meta: ^1.1.6
path: ^1.6.2

gql: ^0.12.0
gql_exec: ^0.2.2
gql_link: ^0.3.0
Expand All @@ -22,15 +18,17 @@ dependencies:
gql_dedupe_link: ^1.0.10

hive: ^1.3.0

quiver: ">=2.0.0 <3.0.0"
normalize: ^0.2.0
http: ^0.12.1
collection: ^1.14.12


dev_dependencies:
pedantic: ^1.8.0+1
mockito: ^4.0.0
test: ^1.5.3
test_coverage: ^0.3.0+1

environment:
sdk: ">=2.6.0 <3.0.0"

2 changes: 1 addition & 1 deletion packages/graphql/test/anonymous_operations_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void main() {
operation: Operation(
document: parseString(addStar),
),
variables: <String, dynamic>{},
variables: {},
context: Context(),
),
),
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/test/graphql_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void main() {
Request(
operation: Operation(
document: parseString(readRepositories),
operationName: 'ReadRepositories',
//operationName: 'ReadRepositories',
),
variables: <String, dynamic>{
'nRepositories': 42,
Expand Down Expand Up @@ -208,7 +208,7 @@ void main() {
Request(
operation: Operation(
document: parseString(addStar),
operationName: 'AddStar',
//operationName: 'AddStar',
),
variables: <String, dynamic>{},
context: Context(),
Expand Down

0 comments on commit 6ba687e

Please sign in to comment.