how to replace "OptimisticCache" in GraphQL flutter?

1k views Asked by At

I just upgrade graphql_flutter version "3.1.0" to "5.0.0-nullsafety.5".

IDE has an exception: "The method 'OptimisticCache' isn't defined for the type 'GraphQLService'."

My code:

    ValueNotifier(
     GraphQLClient(
      cache: OptimisticCache(dataIdFromObject: typenameDataIdFromObject),
      link: link,
      defaultPolicies: DefaultPolicies(
        watchQuery: Policies(
          fetch: FetchPolicy.noCache,
        ),
        query: Policies(
          fetch: FetchPolicy.noCache,
        ),
        mutate: Policies(
          fetch: FetchPolicy.noCache,
        ),
      ),
    ),
  )

How to fix it?

1

There are 1 answers

1
Larry Moore On
final GraphQLCache cache = GraphQLCache(
  dataIdFromObject: uuidFromObject,
);