I try to use the GetX framework in flutter for my project. but it shows the Error regarding RxString. whenever I try to use the Obx method to call the controller object inside a text widget or a other String parameter widget it shows the error
The argument type 'RxString' can't be assigned to the parameter type 'String'
this is my controller class
var qrValue = "waiting".obs;
socket.on('event', (data)
{
var qr = data['final'];
qrValue.value = qr;
print(qrValue);
}
this want to pass the data to generate the qrcode
Obx(() => QrImage(
data: _controller.qrValue,
version: QrVersions.auto,
size: 200.0,
),
)),
when i pass the qrvalue to the argument it show the error
The argument type 'RxString' can't be assigned to the parameter type 'String'
CodePudding user response:
You are passing directly the Rx to the data property of QrImage. You need to pass the value of the Rx:
data: _controller.qrValue.value,