Skip to content

Instantly share code, notes, and snippets.

@shark-h
Created September 4, 2019 10:32
Show Gist options
  • Save shark-h/e5ed92f4d25c9b3ca8e46ba91455d396 to your computer and use it in GitHub Desktop.
Save shark-h/e5ed92f4d25c9b3ca8e46ba91455d396 to your computer and use it in GitHub Desktop.
String getQuestion = """
query GetQuestion(\$userID: String!) {
unanswered_questions(args: {userid: \$userID}, limit: 1) {
id
question
question_answers {
id
answer
is_correct
}
}
}
""";
Query(
options: QueryOptions(
fetchPolicy: FetchPolicy.networkOnly,
document: getQuestion,
variables: {
'userID': user.uid,
},
),
builder: (QueryResult result, {VoidCallback refetch}) {
if (result.errors != null) {
return Center(child: Text(result.errors.toString()));
}
if (result.loading) {
return Center(child: CircularProgressIndicator());
}
… UI STAFF
},
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment