Avoid Using @observable in Polymer

From this link:

http://blog.sethladd.com/2013/09/forms-http-servers-and-polymer-with-dart.html

I know that you can observe the values ​​of Object, but how can I avoid using @observable for every variable in the class. Thus, I do not need to set @observable multiple times. Therefore, instead of:

class Person extends Object with Observable {
  @observable String name;
  @observable String age;
}

Simply:

class Person {
  String name;
  String age;
}
+4
source share
1 answer

I have never used it, but as far as I remember, you can apply @observableto the class as well.
I will check and update the answer ...

@observable
class Person extends Object with Observable {
  String name;
  String age;
}

Strike>

EDIT

I mixed it with @reflectable. @observablemust be applied to each field separately.

class Person extends Object with Observable {
  @observable String name;
  @observable String age;
}
+1

All Articles