Home > Software engineering >  i got 'Controller' doesn't conform to the bound 'GetxController*' of the ty
i got 'Controller' doesn't conform to the bound 'GetxController*' of the ty

Time:05-20

class Controller extends GetxController {
  var todoList = <Todos>[].obs;

  @override
  void onInit() {
    _configureAmplify();
    super.onInit();
  }


=============================================================



class Controller extends GetxController {
  var todoList = <Todos>[].obs;

  @override
  void onInit() {
    _configureAmplify();
    super.onInit();
  }

as you can see here i got GetxController here

but as you can see i got 'Controller' doesn't conform to the bound 'GetxController*' of the type parameter 'T'. problem here

Can someone help me to fix that problem there are few resources on the internet and it didn't help me i can't solve the problem

CodePudding user response:

try to change import above from

import 'package:get_state_manager/get_state_manager.dart'

to

 import 'package:get/get.dart'

from HomeScreen

CodePudding user response:

you can change your file and controller name or you can try this

import your controller file like this


import"../controller/controller.dart" as ctrl


and use it like this

GetBuilder<ctrl.controller>(
builder: (_) => MyWidget();
);

  • Related