GetxController 不是 GetxController 的子类型

GetxController is not subtype of GetxController

我目前正在开发电子商务应用程序,其中我将底部导航放在主页上,每个图标上都有徽章,在这里,当我将 cartItems 计数器徽章放在 CartIcon 上并在主页上注入 cartcontroller 的依赖项时(我尝试了两种方法使用Getbuilder 和 Obx),但由于我也使用底部导航必须通过 cartscreen 导航我的应用程序,它也具有 cartcontroller 依赖项,出现以下错误。这就像我不能在小部件树中的父和子小部件中放置相同的控制器。 PS:I 也尝试过 Get.find() 用于购物车屏幕。 这是错误:

════════ Exception caught by widgets library ═══════════════════════════════════
The following _CastError was thrown building Builder:

    type 'CartController' is not a subtype of type 'CartController' in type cast where
    CartController is from sourcepath/controllers/cartController.dart
    sourcepath/controllers/cartcontroller.dart:1
    CartController is from sourcepath/controllers/cartcontroller.dart

到目前为止,我了解到您有两个不同的控制器 一个是 cartController,另一个是 cartcontroller(注意驼峰式外壳),所以从技术上讲,您不能将它们组合在一起。请检查您的代码。