I'm not able to convert RxString to String.
Use .value to get it
On Thu, 20 Aug 2020, 16:17 Vivek Sharma, notifications@github.com wrote:
I'm not able to convert RxString to String.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/jonataslaw/getx/issues/485#issuecomment-677481085,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAOVMXCTQMRHCE2GS54UWKTSBTS2VANCNFSM4QF2UH4A
.
@follow2vivek don't declare your variable like this:
String item = ''.obs;
Rather do this:
var item = ''.obs
or
RxString item = ''.obs
The process that I followed.
declared a variable
var imageLink = ''.obs;
API call and got a new value.
imageLink = newValue;
3.Used Obx to update the widget
_controller.imageLink.value
_controller.imageLink.string
_controller.imageLink.toString()
I have tried all the 3 available options but still, I'm getting - type 'String' is not a subtype of type 'RxString'.
declared a variable
var imageLink = ''.obs;API call and got a new value.
imageLink.value = newValue; // Here
You need the ".value" to make a setter.
Please ask support questions on specific platform channels for this.
I recommend you use "final" instead of "var", this will prevent you from making mistakes like that, from trying to add the variable to an Rx without the .value.
As this is not a mistake, I am closing this.
Most helpful comment
You need the ".value" to make a setter.
Please ask support questions on specific platform channels for this.
I recommend you use "final" instead of "var", this will prevent you from making mistakes like that, from trying to add the variable to an Rx without the .value.
As this is not a mistake, I am closing this.