refresh method

  1. @override
void refresh()
override

Makes a direct update of value adding it to the Stream useful when you make use of Rx for custom Types to referesh your UI.

Sample:

 class Person {
    String name, last;
    int age;
    Person({this.name, this.last, this.age});
    @override
    String toString() => '$name $last, $age years old';
 }

final person = Person(name: 'John', last: 'Doe', age: 18).obs;
person.value.name = 'Roi';
person.refresh();
print( person );

Implementation

@override
void refresh() {
  super.refresh();
  ///根据不同type数据,赋值对应的state,但通用性有待考察使用场景,例如:
  if(value.isEmpty) {
    setEmpty();
  }else{
    setSuccess();
  }
}