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
| final allCompanies = CompaniesData.fromJson(result.data).allCompanies; | |
| return ListView.builder( | |
| itemBuilder: (_, index) { | |
| return ListTile( | |
| leading: Icon(Icons.card_travel), | |
| title: Text(allCompanies[index].name), | |
| subtitle: Text(allCompanies[index].industry), | |
| ); | |
| }, |
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
| if (result.loading) { | |
| return const Center( | |
| child: CircularProgressIndicator(), | |
| ); | |
| } |
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
| if (result.hasException) { | |
| return Text(result.exception.toString()); | |
| } |
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, | |
| ), |
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
| 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
| 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
| 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
| 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
| targets: | |
| $default: | |
| sources: | |
| - lib/** | |
| - graphql/** | |
| - my.schema.json | |
| builders: | |
| artemis: | |
| options: | |
| schema_mapping: |
NewerOlder