小编GIL*_*ILO的帖子

Flutter in_app_purchase '_enablePendingPurchases':在调用 startConnection 之前必须调用 enablePendingPurchases()

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

bool available = await InAppPurchaseConnection.instance.isAvailable();
Run Code Online (Sandbox Code Playgroud)

但是它正在返回错误

E/flutter (14525): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] 未处理的异常:'package:in_app_purchase/src/billing_client_wrappers/billing_client_wrapper.dart':断言失败:第 101 行 pos 12:结尾 PurchaensableP ': enablePendingPurchases() 必须在调用 startConnection 之前调用

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

in-app-purchase dart flutter

12
推荐指数
1
解决办法
1812
查看次数

Flutter GitHub Actions 可执行文件中的错误 CPU 类型

您好,我目前正在为我的 flutter 项目使用 CI/CD 的GitHub Action

我认为这runs-on: macOS-latest将是苹果硅。当它运行时,flutter pub getbuild_ios:收到此错误。

/Users/runner/hostedtoolcache/flutter/2.13.0-0.1.pre-dev/x64/bin/internal/shared.sh: line 225: 
/Users/runner/hostedtoolcache/flutter/2.13.0-0.1.pre-dev/x64/bin/cache/dart-sdk/bin/dart: Bad CPU type in executable
Run Code Online (Sandbox Code Playgroud)

现在我认为问题可能与 GitHub 操作上没有安装 rosseta Stone 有关?

关于如何安装罗塞塔石有什么想法,或者这是一个不同的错误吗?

dart flutter github-actions apple-silicon

8
推荐指数
1
解决办法
2252
查看次数

Flutter Firestore 重置缓存

目前我有来自手机缓存的文档快照。我从

print(document.metadata.isFromCache ? "NOT FROM NETWORK" : "FROM NETWORK");// document is a DocumentSnapshot
Run Code Online (Sandbox Code Playgroud)

flutter:不是来自网络

然而,我已经从 firestore 中删除了其中一些文档,但它们仍然出现。我想知道是否有一种方法可以在 flutter 中重置 firestore 的缓存,以便所有文档都来自云端。

感谢您的帮助 - 非常感谢。

dart firebase flutter google-cloud-firestore

6
推荐指数
1
解决办法
4899
查看次数

如何在dart中将二进制数转换为十进制分数?

您好,我一直想知道是否有一种方法可以将二进制数转换为十进制分数。

我知道如何通过此代码更改基础作为示例

String binary = "11110010";

//I'd like to change this line so it produces a decimal value
String denary = int.parse(binary, radix: 2).toRadixString(10);
Run Code Online (Sandbox Code Playgroud)

dart flutter

5
推荐指数
2
解决办法
5393
查看次数

Flutter In App Purchase我应该在_verifyPurchase()中包含什么

嗨,我目前一直在使用 Flutter in app 支付插件示例https://github.com/flutter/plugins/tree/master/packages/in_app_purchase/example。在付款发生后的代码中,有一个名为_verifyPurchase当前的函数,该函数如下所示。

Future<bool> _verifyPurchase(PurchaseDetails purchaseDetails) {
  // IMPORTANT!! Always verify a purchase before delivering the product.
  // For the purpose of an example, we directly return true.
  return Future<bool>.value(true);
}
Run Code Online (Sandbox Code Playgroud)

目前它总是返回 true 但是我不完全理解我需要在此处包含什么验证过程来验证购买。

我需要在此处包含哪些验证过程来验证购买

我目前对这个功能中实际需要什么感到困惑。

in-app-purchase dart flutter

5
推荐指数
1
解决办法
525
查看次数

Python firebase 存储模拟器

您好,我想知道如何连接到我的 firebase 存储模拟器,这就是我连接到 Firestore 的方式。我如何使用存储来做到这一点

火库示例:

if emulator:
    os.environ["FIRESTORE_EMULATOR_HOST"] = "0.0.0.0:8080"
    os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "myCredentials.json"

# Retrieve the application credentials
cred = credentials.ApplicationDefault()

options = {
    "storageBucket": "my-storage-bucket-name.appspot.com"
}

# Initialise the app
firebase_app = firebase_admin.initialize_app(cred, options)
Run Code Online (Sandbox Code Playgroud)

firebase 存储的等效项是什么?

python firebase-tools firebase-storage

5
推荐指数
1
解决办法
987
查看次数

如何以编程方式打开键盘文本字段

嗨,我想知道是否有可能在 flutter 中以编程方式打开键盘并立即准备好光标和文本字段。

我已经知道如何拉起键盘 FocusScope.of(context).requestFocus(FocusNode());

但我还需要知道如何让文本字段准备好输入,而无需用户点击文本字段。如

假设我有一个文本字段:

TextField(
  controller: textEditingController,
);
Run Code Online (Sandbox Code Playgroud)

我想使用代码实现下面的效果,以便用户不必点击文本字段

textEditingController.openTextField()//Pseudo code
Run Code Online (Sandbox Code Playgroud)

: 编辑 - - - - - - - - - - - - - - - - - -

我有点坏,但我忘了在文本字段上添加焦点节点作为参数

在您的班级中添加

最终 FocusNode _focusNode = FocusNode();

然后添加到文本字段

TextField(
  ...
  focusNode:_focusNode,
  ...
);
Run Code Online (Sandbox Code Playgroud)

然后通过运行调用它

_focusNode.requestFocus();
Run Code Online (Sandbox Code Playgroud)

dart flutter

4
推荐指数
1
解决办法
297
查看次数

Flutter iOS 自动填充强密码错误

我收到此错误:

[自动填充] 无法显示应用程序包 ID:com.my.app 的自动强密码,因为错误:无法保存此应用程序的密码。确保您已为应用程序设置关联域并在“设置”中启用自动填充密码

我已启用关联域和自动填充凭据提供程序

在此输入图像描述

关联的域也在 appstore connect 上启用。

在我的物理设备上启用了自动填充

在此输入图像描述

这是我的代码

AutofillGroup(
  child: Column(
    children: <Widget>[
      CupertinoTextField(
        controller: email,
        enableSuggestions: true,
        keyboardType: TextInputType.emailAddress,
        autofillHints: [AutofillHints.email],
      ),
      CupertinoTextField(
        controller: newPassword,
        enableSuggestions: true,
        autofillHints: [AutofillHints.newPassword],
      )
    ],
  ),
)
Run Code Online (Sandbox Code Playgroud)

我希望这样的事情发生:

在此输入图像描述

autofill ios dart flutter

4
推荐指数
1
解决办法
2189
查看次数

如何在颤振中标准化[-1, 1]之间的数据

我想知道 flutter 中是否有内置的标准化功能。就像这样工作

List<int> array = [-105,24,66,-50,-49,2]

//Normalises to get numbers between -1 and 1
List<double> normalised = array.normalise(-1,1) 
Run Code Online (Sandbox Code Playgroud)

android normalization dart flutter

3
推荐指数
1
解决办法
1930
查看次数

Flutter firebase 从真实设备连接到模拟器

您好,我目前正在使用 firebase 的本地模拟器和 flutter。但是,我使用的是真实设备而不是模拟器,因此我不知道如何连接到我的笔记本电脑本地主机。我目前正在使用这段代码

  // [Firestore | localhost:8080]
  FirebaseFirestore.instance.settings = const Settings(
    host: "localhost:8080",
    sslEnabled: false,
    persistenceEnabled: false,
  );

  // [Authentication | localhost:9099]
  await FirebaseAuth.instance.useEmulator("http://localhost:9099");

  FirebaseFunctions.instance.useFunctionsEmulator(
      origin: "http://localhost:5001"
  );

  // [Storage | localhost:9199]
  await FirebaseStorage.instance.useEmulator(
    host: "localhost",
    port: 9199,
  );
Run Code Online (Sandbox Code Playgroud)

firebase firebase-tools flutter google-cloud-functions

3
推荐指数
1
解决办法
2359
查看次数

Flutter M1 Mac ld:找不到框架 google_sign_in

我在 m1 Mac 上遇到以下错误

1 warning generated.
ld: framework not found google_sign_in
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Run Code Online (Sandbox Code Playgroud)

====已解决====

我要做的就是去

Xcode => Runner => 构建设置 => 在链接下 => 双击“其他链接器标志”

删除这两个

-framework
"google_sign_in"
Run Code Online (Sandbox Code Playgroud)

仅“google_sign_in”之前的框架

也有同样的问题image_picker

dart google-signin flutter apple-silicon

2
推荐指数
1
解决办法
481
查看次数

Flutter PopupMenuButton 删除飞溅和突出显示

我想知道是否有一种方法可以像其他按钮一样从 PopupMenuButton 中删除飞溅和突出显示。

new PopupMenuButton({
  ...
  splashColor: Colors.transparent,  
  highlightColor: Colors.transparent, // makes highlight invisible too
})
Run Code Online (Sandbox Code Playgroud)

dart flutter

1
推荐指数
1
解决办法
3152
查看次数