【问题标题】:how to replace "OptimisticCache" in GraphQL flutter?如何替换 GraphQL 颤振中的“OptimisticCache”?
【发布时间】:2021-08-17 09:21:46
【问题描述】:

我只是将graphql_flutter 版本“3.1.0”升级到“5.0.0-nullsafety.5”。

IDE 有一个例外:“方法 'OptimisticCache' 没有为类型 'GraphQLService' 定义。”

我的代码:

    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,
        ),
      ),
    ),
  )

如何解决?

【问题讨论】:

标签: flutter graphql-flutter


【解决方案1】:
final GraphQLCache cache = GraphQLCache(
  dataIdFromObject: uuidFromObject,
);

【讨论】:

  • 请不要只发布代码作为答案,还要解释您的代码的作用以及它如何解决问题的问题。带有解释的答案通常更有帮助,质量更高,更有可能吸引投票。
猜你喜欢
  • 1970-01-01
  • 2020-02-01
  • 2021-05-06
  • 1970-01-01
  • 2021-09-03
  • 2020-10-15
  • 1970-01-01
  • 2021-10-07
  • 2019-05-23
相关资源
最近更新 更多