我有一个项目必须卖给另一个客户,所以我想找到一种统一代码的方法,当我发布一些更新时,我只需要操作一个代码(当然,也要保持每个代码的特殊性)。
问题是,在我的第一个应用程序中,我使用的是firebase_messaging及其google-services.json。但在这个新客户里我不会用它..。我试图运行,它抛出了这个错误:
E/flutter ( 7850): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: [core/not-initialized] Firebase has not been correctly initialized. Have you added the "google-services.json" file to the project?
E/flutter ( 7850):
E/flutter ( 7850): View the Android Installation documentation for more information: https://firebase.flutter.dev/docs/installation/android
E/flutter ( 7850):
E/flutter ( 7850): #0 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:86:9)
E/flutter ( 7850): <asynchronous suspension>
E/flutter ( 7850): #1 Firebase.initializeApp (package:firebase_core/src/firebase.dart:44:9)
E/flutter ( 7850): <asynchronous suspension>
E/flutter ( 7850): #2 main (package:app_md/main.dart:72:3)
E/flutter ( 7850): <asynchronous suspension>
E/flutter ( 7850): 如何处理不使用firebase_messaging:的子项目?我正在使用“config”参数来完成这项工作
我用了这个方法:https://medium.com/@ramiechaarani/how-to-make-a-white-label-app-in-flutter-6c3ea40fd7d5
总括而言:
我有一个主应用程序,最初我对一个客户做了。这个客户端使用防火墙。现在,我只想保留主要功能,并将其单独用于另一个客户端。问题是,这个新客户端不使用firebase,所以当我尝试运行应用程序时,它会抛出错误,因为我没有google-services.json。我怎么能说在这个项目(它继承了主项目)中,我不会使用firebase?
预期结果:在第二个品牌的应用程序中,不要使用防火墙。
也许有一种方法可以覆盖依赖关系?或者还有另一种方法来实现我的目标。
发布于 2021-03-22 14:50:13
implementation)
这本质上就是Separation of conerns的意义所在。你的区块(或者你用来做业务逻辑的东西)不需要知道“东西”从哪里来。他们所关心的就是“东西”来了。
为了更好地理解SoC,您可能想读一些比维基百科文章更容易读的东西,例如:How do you explain Separation of Concerns to others?。
https://stackoverflow.com/questions/66748166
复制相似问题