This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Schema", | |
"schemaPath": "my.schema.json", | |
"extensions": { | |
"endpoints": { | |
"Default": { | |
"url": "http://localhost:9002/graphql", | |
"introspect": true | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query EmployeeData($id: ID!) { | |
employee(id: $id) { | |
firstName | |
id | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# …………………………… | |
dependencies: | |
# …………………………… | |
graphql_flutter: ^3.0.0-beta.3 | |
path_provider: ^1.5.1 | |
equatable: ^1.0.2 | |
json_serializable: ^3.2.3 | |
gql: 0.12.0 | |
dev_dependencies: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
targets: | |
$default: | |
sources: | |
- lib/** | |
- graphql/** | |
- my.schema.json | |
builders: | |
artemis: | |
options: | |
schema_mapping: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query CompaniesData { | |
allCompanies { | |
id | |
name | |
industry | |
__typename | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:graphql_flutter/graphql_flutter.dart'; | |
import 'package:flutter/material.dart'; | |
String uuidFromObject(Object object) { | |
if (object is Map<String, Object>) { | |
final String typeName = object['__typename'] as String; | |
final String id = object['id'].toString(); | |
if (typeName != null && id != null) { | |
return <String>[typeName, id].join('/'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String get host { | |
if (Platform.isAndroid) { | |
return '10.0.2.2'; | |
} else { | |
return 'localhost'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GraphqlProvider( | |
uri: 'http://$host:9002/graphql', | |
child: MaterialApp(…), | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Query( | |
options: QueryOptions( | |
documentNode: CompaniesDataQuery().document, | |
), | |
builder: ( | |
QueryResult result, { | |
Future<QueryResult> Function() refetch, | |
FetchMore fetchMore, | |
}) { | |
if (result.hasException) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options: QueryOptions( | |
documentNode: CompaniesDataQuery().document, | |
), |
OlderNewer