-
-
Save archived001/f87ae385d27caa28bd1c7b706af8158f 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$Query.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