小编Nan*_*ame的帖子

FirebaseCommandException:尝试运行命令时 Firebase CLI 发生错误

Flutterfire 刚刚添加了一个 CLI 供我们使用,但我在flutterfire configure command. 我不断收到此错误:

我找到 0 个 Firebase 项目。选择项目 liveasy-1。FirebaseCommandException:尝试运行命令时 Firebase CLI 发生错误。命令:firebase --version 错误:FlutterFire CLI 目前还需要安装官方 Firebase CLI,请参阅https://firebase.google.com/docs/cli#install_the_firebase_cli了解如何安装它。

即使我已经安装了 Firebase CLI 并且可以firebase --version毫无问题地运行。我安装了独立的二进制文件,当它不起作用时,我也使用 npm 安装了它。我可以登录并查看我的项目列表,但运行flutterfire configure似乎是一个问题。我也无法在 Visual Studio Code 中访问任何 Firebase 命令。

我应该在环境变量的PATH中添加一些东西吗?我已经添加了 flutterfire 所在的cache/bin/,但我不知道如何对 Firebase 执行相同的操作。

dart firebase flutter

59
推荐指数
6
解决办法
9万
查看次数

Flutterfire ios配置问题

由于某种原因,我无法使用 Flutterfire CLI 在 firebase 上配置 ios 应用程序。我以前这样做过,但这次我收到了这个错误

FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase apps:create ios good_dreams (ios) --bundle-id=com.infatechnologies.good_dreams --json --project=good-dreams-app 
ERROR: Failed to create iOS app for project good-dreams-app. See firebase-debug.log for more info.
Run Code Online (Sandbox Code Playgroud)

我尝试检查 debug.log 文件以查看问题所在,并看到一个带有 401 错误代码的发布请求作为响应。

{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED",
"details": [ …
Run Code Online (Sandbox Code Playgroud)

dart firebase flutter

6
推荐指数
3
解决办法
1596
查看次数

无法将 _InternalLinkedHashMap<Object?, Object?> 转换为任何内容

尽管我首先将其作为地图上传,但从 Firebase RealtimeDatabase 获取数据作为地图时遇到了一些问题。我看到的所有解决方案都是您应该将 snapshot.value 转换为传入的数据类型,但对我来说没有任何迭代。我已经能够调用toString()快照值,并且已经验证它是一个 Map,但编译器甚至不允许我将其转换为 Map,更不用说运行它了。如果我尝试使用动态来防止编译错误,我仍然会得到这个 Unhandled Exception: type '_InternalLinkedHashMap<Object?, Object?>' is not a subtype of type 'Map<String, dynamic>?' in type cast

这就是我所做的,

  Future<Map<String, dynamic>> getBasicDetail(
      DatabaseReference databaseReference) async {
    DatabaseReference imageURLevent = databaseReference.child('basicDetail');

    final snapShot = await imageURLevent.get();
    return Map<String, dynamic>.from(
        snapShot.value as Map<String, dynamic>? ?? {});
  }

  Future<void> readProfileData({required String userId}) async {

    DatabaseReference ref = FirebaseDatabase.instance.ref("users/$userId");

    final basicDetail = await getBasicDetail(ref);
    
    // Print the data of the snapshot
    debugPrint(basicDetail.toString());
  }
Run Code Online (Sandbox Code Playgroud)

我已经尝试了解析这些数据的所有可能的组合,但没有任何效果。由于某些原因,在示例和视频中,当您将右侧投射到右侧时,Map<String,dynamic> …

dart firebase-realtime-database flutter

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