Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 21, 2022 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/07a3c636efaff55c194fe31e9ba1607d to your computer and use it in GitHub Desktop.
Save velotiotech/07a3c636efaff55c194fe31e9ba1607d to your computer and use it in GitHub Desktop.
class MyHomePage extends StatelessWidget { @override Widget build(BuildContext) {   return Query(     options: QueryOptions(       document: gql(readCounters),       variables: {         'counterId': 23,       },       pollInterval: Duration(seconds: 10),     ),     builder: (QueryResult result,         { VoidCallback refetch, FetchMore fetchMore }) {       if (result.hasException) {         return Text(result.exception.toString());       }‍       if (result.isLoading) {         return Text('Loading');       }‍       // it can be either Map or List       List counters = result.data['counter'];‍       return ListView.builder(           itemCount: repositories.length,           itemBuilder: (context, index) {             return Text(counters\[index\]['name']);           });     },) }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment