【问题标题】:A value of type 'String' can't be assigned to a variable of type 'RxString' in flutter Getx在颤振Getx中,不能将“String”类型的值分配给“RxString”类型的变量
【发布时间】:2021-12-26 09:23:37
【问题描述】:

我正在尝试在 Getx 控制器中将图像转换为 base64 文本,但它显示错误消息“无法将 'String' 类型的值分配给 'RxString' 类型的变量”。

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: flutter base64 state-management flutter-getx image-conversion


【解决方案1】:
final RxString rxstring = 'Hello'.obs;

rxstring.value = 'Hi'; // <-- this can change the value of the Rx variable and also trigger its listeners

【讨论】:

    猜你喜欢
    • 2020-07-02
    • 2021-03-28
    • 2021-08-05
    • 1970-01-01
    • 1970-01-01
    • 2021-12-10
    • 2021-10-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多