Karan V
Karan V

Reputation: 363

how to use Conditional rendering with getX boolean observable

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'.

Upvotes: 2

Views: 2235

Answers (1)

esentis
esentis

Reputation: 4686

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

Upvotes: 1

Related Questions