Git Product home page Git Product logo

Comments (7)

zoechi avatar zoechi commented on May 5, 2024

You don't need to extend Observable you can use it as mixin

class SomeMessage extends GeneratedMessage with Observable {
 ...
}

The bigger problem is to know on what fields the annotations @observable should be applied or should maps and lists also wrapped in toObservable([]).
I think this should be defined in the proto files in some way for each property.

from protobuf.dart.

Taack avatar Taack commented on May 5, 2024

For all field is not an option?

All fields in my proto need to be observable. It would help if we can
support this globally. A command line switch would be perfect.

Thanks for your support.
Le 23 sept. 2014 09:10, "Günter Zöchbauer" [email protected] a
écrit :

You don't need to extend Observable you can use it as mixin

class SomeMessage extends GeneratedMessage with Observable {
...}

The bigger problem is to know on what fields the annotations @observable
should be applied or should maps and lists also wrapped in toObservable([]).
I think this should be defined in the proto files in some way for each
property.


Reply to this email directly or view it on GitHub
https://github.com/dart-lang/dart-protoc-plugin/issues/29#issuecomment-56483198
.

from protobuf.dart.

zoechi avatar zoechi commented on May 5, 2024

I didn't do much deep thinking about this topic yet but I'm sure it could be very useful in some projects and don't see a problem applying @observable on all simple fields String, int, double, bool but I am not so sure about collections, references to other classes. Normally all features come with a cost. It would be interesting to hear other thoughts.

from protobuf.dart.

d3v-cl avatar d3v-cl commented on May 5, 2024

dart protobuffer messages store values in a map. There is no easy way to add @observable to simple fields. Access to such values are all wrapped in getters and setters.

Contrary to the Observable mixin ChangeNotifier doesn't use dirtyChecking.
As we wrap any modification in setField/clearField anyway I don't see any reason not to use ChangeNotifier.

I admit that I didn't think about Lists.
Are there any maps in protobuffers?

from protobuf.dart.

skybrian avatar skybrian commented on May 5, 2024

I've started working on observable messages and repeated fields. Related bug:
#43

from protobuf.dart.

skybrian avatar skybrian commented on May 5, 2024

In 0.4.2, you can subclass a GeneratedMessage to override the getter for eventPlugin and the new createRepeatedField() method to find out when fields change. This isn't a complete solution but it provides the hooks to write one.

from protobuf.dart.

osa1 avatar osa1 commented on May 5, 2024

This won't be implemented. We are currently working on removing the existing eventPlugin API.

from protobuf.dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.