Shreyas Jadhav
Shreyas Jadhav

Reputation: 2571

Flutter: PartialDataException (PartialDataException(path: ingredients)) How to solve?

I'm using graphql_flutter package, I'm trying to solve PartialDataException error for my query. I have no clue why this is happening for so long. My query and variables seem correct. and other similar queries do work. But this one won't!

 Query(
                                options: QueryOptions(
                                  document: gql(
                                      """query Ingredients(\$where: IngredientWhereInput!) {
  ingredients(where: \$where) {
    name
    image {
      url
    }
    id
  }
}"""),
                                  variables: {
                                    "where": {
                                      "id": {
                                        "notIn": widget.ingredients
                                            .map((e) => e.id)
                                            .toList()
                                      }
                                    },
                                  },
                                ),
                                builder: (QueryResult result,
                                    {VoidCallback? refetch,
                                    FetchMore? fetchMore}) {
                                  if (result.isLoading) {
                                    return const CircularProgressIndicator();
                                  }

                                  if (result.hasException ||
                                      result.data == null) {
                                    return const Text("Something went wrong!");
                                  }

                                  final List<dynamic> ingredients =
                                      result.data?['ingredients'];
                                  return Expanded(
                                    child: ListView.builder(
                                      itemCount: ingredients.length,
                                      itemBuilder: (context, index) {

Upvotes: 0

Views: 36

Answers (0)

Related Questions