gpt4 book ai didi

flutter in_app_purchase '_enablePendingPurchases' : enablePendingPurchases() must be called before calling startConnection

转载 作者:行者123 更新时间:2023-12-03 17:15:41 31 4
gpt4 key购买 nike

我正在使用下面的简单代码

bool available = await InAppPurchaseConnection.instance.isAvailable();

但是它正在返回错误

E/flutter (14525): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: 'package:in_app_purchase/src/billing_client_wrappers/billing_client_wrapper.dart': Failed assertion: line 101 pos 12: '_enablePendingPurchases': enablePendingPurchases() must be called before calling startConnection



我想知道是否有人知道这个错误的原因,如果是的话我应该怎么做,很高兴有任何建议 - 谢谢。

最佳答案

文档在这方面非常薄,实际上应该更清楚。您需要在 main() 中包含以下行才能使其工作。

void main() {
///Include this in main() so purchases are enabled
InAppPurchaseConnection.enablePendingPurchases();

runApp(MyApp());
}

关于 flutter in_app_purchase '_enablePendingPurchases' : enablePendingPurchases() must be called before calling startConnection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60046903/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com