Been building an app using Flutter and calling to GraphQL database. At the moment, I have just been accessing data by wrapping the following in a stateless widget:
return Query(
options: QueryOptions(
document: gql(exampleGraphQL),
),
builder: (QueryResult result, {fetchMore, refetch}) {
if (result.hasException) {
return Text(result.exception.toString());
}
if (result.isLoading) {
return const Center(
child: CircularProgressIndicator(),
);
}
var exampleData = result.data?['example'];
return Scaffold(...
But now, I am attempting to make a sortable DataTable, and I need to access the data in a stateful widget (or access it in a simple class) that cannot return a scaffold and just returns the data I want to access. I have looked for hours and cannot find how to access GraphQl data without returning a widget. Any help would be greatly appreciated.