Skip to content

Instantly share code, notes, and snippets.

@archived001
Forked from vasilich6107/materialapp.body.dart
Last active October 19, 2020 18:37
Show Gist options
  • Save archived001/f87ae385d27caa28bd1c7b706af8158f to your computer and use it in GitHub Desktop.
Save archived001/f87ae385d27caa28bd1c7b706af8158f to your computer and use it in GitHub Desktop.
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