how to use Conditional rendering with getX boolean observable

Issue

In my login controller:

class LoginController extends GetxController {
  final GlobalKey<FormState> loginFormKey = GlobalKey<FormState>();

  late TextEditingController emailController, passwordController;
  var isloading = false.obs;    <<<<<<<<<<<<
...

and in my view file:

 Container(
  color: Colors.blueGrey,
  width: double.infinity,
  height: 150,

  child: Obx(()=>
    Center(
      child: logincontroller.isloading ? CircularProgressIndicator(): Container(),

    ),
  )
)

however I keep getting this message:

33:50: Error: A value of type ‘RxBool’ can’t be assigned to a variable
of type ‘bool’.

Solution

Try logincontroller.isLoading.value to check the value of RxBool

Answered By – esentis

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.