Created
January 13, 2020 21:13
-
-
Save vasilich6107/455a5358bd8a9efbb4d53e1bf72526b8 to your computer and use it in GitHub Desktop.
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) { | |
return Text(result.exception.toString()); | |
} | |
if (result.loading) { | |
return const Center( | |
child: CircularProgressIndicator(), | |
); | |
} | |
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), | |
); | |
}, | |
itemCount: allCompanies.length, | |
); | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
небольшая опечатка в примере