Created
September 4, 2019 10:32
-
-
Save shark-h/e5ed92f4d25c9b3ca8e46ba91455d396 to your computer and use it in GitHub Desktop.
This file contains 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
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