小编Jet*_*ope的帖子

如何在同一个项目中在 Flutter 和原生 Android 中使用 Firebase?

我有一个 flutter 项目,依赖 Firebase 进行身份验证、firestore 和功能。但是,我有一个接收器类,它扩展了 BroadcastReceiver 并在应用程序的 android 端后台运行。在此接收器类中,我使用 Firestore、Analytics、Auth 和 Cloud_Functions。

\n

鉴于这种独特的 Android 设置,我需要在应用程序级别的 build.gradle 文件中实例化以下依赖项:

\n
implementation 'com.google.firebase:firebase-firestore:24.3.1'\n    implementation 'com.google.firebase:firebase-auth:21.0.8'\n    implementation 'com.google.firebase:firebase-firestore-ktx:24.3.1'\n    implementation 'com.google.firebase:firebase-messaging:23.0.8'\n    implementation 'com.google.firebase:firebase-messaging-ktx'\n    implementation 'com.google.firebase:firebase-functions-ktx:20.1.1'\n    implementation 'com.google.firebase:firebase-analytics-ktx:21.1.1'\n    implementation platform('com.google.firebase:firebase-bom:30.4.0')\n    implementation 'com.google.firebase:firebase-auth-ktx'\n
Run Code Online (Sandbox Code Playgroud)\n

我的 Flutter pubspec.yaml 文件中还有以下内容:

\n
firebase_core: ^1.24.0\n  cloud_firestore: ^3.5.1\n  firebase_messaging: ^13.1.0\n  cloud_functions: ^3.3.9\n  firebase_auth: ^3.11.2\n
Run Code Online (Sandbox Code Playgroud)\n

因为 Flutter 项目本身还处理许多其他依赖于 Firebase 的事情(使用这些库的 iOS 和 Android 之间的共享组件)。

\n

我只在 iOS 上测试了我的应用程序,它构建并运行良好,因为我在后台没有使用任何类型的 iOS 特定类,而且我还自行运行了 Android 应用程序,没有颤动,它构建并运行良好。但是,当我将这些本机 Android 类引入我的 flutter 项目时,在将我的应用程序转为 Android 时出现运行时错误:

\n
E/flutter …
Run Code Online (Sandbox Code Playgroud)

android kotlin firebase flutter flutter-dependencies

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

如何查找项目是否包含在 Julia 的 Dict 中

我对 Julia 还很陌生,正在尝试弄清楚如何检查给定的表达式是否包含在我创建的 Dict 中。

function parse( expr::Array{Any} )
   if expr[1] == #check here if "expr[1]" is in "owl"
       return BinopNode(owl[expr[1]], parse( expr[2] ), parse( expr[3] ) )
   end
end

owl = Dict(:+ => +, :- => -, :* => *, :/ => /)
Run Code Online (Sandbox Code Playgroud)

我查看了 Julia 的文档和其他资源,但找不到任何答案。

“owl”是我要检查的字典的名称。我想运行 return 语句应该 expr[1] 是“+,-,* 或 /”。

dictionary if-statement julia

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

错误:候选函数不可行:“this”参数的类型为“const”,但方法未标记为 const

我在尝试编译项目时遇到了一些问题。它不断给我消息:“候选函数不可行:'this'参数的类型为'const',但方法未标记为const”。以下是出现此错误的函数。

bool operator<(const node& x) const{
    if(name < x.name){
        return true;
    } else{
        return false;
    }
}

bool operator==(const node& x){
    if(name == x.name){
        return true;
    } else{
        return false;
    }
}
Run Code Online (Sandbox Code Playgroud)

如果有人有任何想法或知道我在使用 const 时出了什么问题,我将非常感激。

c++ constants function operator-keyword

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