Getx: type 'String' is not a subtype of type 'RxString'

Created on 20 Aug 2020  Â·  5Comments  Â·  Source: jonataslaw/getx

Most helpful comment

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.

All 5 comments

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.

  1. declared a variable
    var imageLink = ''.obs;

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

williamsilva-98 picture williamsilva-98  Â·  4Comments

Denilson-source picture Denilson-source  Â·  3Comments

DarkHeros09 picture DarkHeros09  Â·  3Comments

definev picture definev  Â·  3Comments

NO-ob picture NO-ob  Â·  4Comments