Replies: 3 comments 1 reply
-
I just found that I can change this: cc.read(connectionCapsule)(listener).sendMessageResource(messageData); with: _getConnection(listener).sendMessageResource(messageData); But it doesn't change anything on this issue. |
Beta Was this translation helpful? Give feedback.
-
Let say that, now, doing the Flutter part, I adopted a better practice: I still have helper classes along with the Side Effect, but not returning them, returning some of their methods instead. I will readapt it too for Backend, but again, it doesn't change anything on this issue. |
Beta Was this translation helpful? Give feedback.
-
There's a bit too much code to review here for me, but I'll try to give some feedback on what you said you did.
That all seems fine.
Not so sure about that and making |
Beta Was this translation helpful? Give feedback.
-
https://gist.github.com/busslina/7bfd02ccd1e615220d591d5a6c184d86
Firstly, I have two types of listener, so don't confuse them:
My structure is:
Connection
class and theConnectionController
class (plus other helper classes).asResource
Side Effect, which is formed by_ResourceValueWrapper
,_ResourceListeners
and_ResourceLock
classes.The problematic: (Side Effects cannot use other capsules, so to be able inside
asResource
to listen a specific connection state change it requires aConnection
getter parameter,getConnection
). Then, inside_ResourceListeners
and_ResourceLock
classes it is used (getConnection
) to listen to specific connection state changes, using a helper classConnectionStateListenerManager
(seeconnection.dart
) that allows only one listener per connection.That's it. I tried to do as simpler and smarter as I could.
You can note that I decided the connection capsules to be immutable. But I don't think that making them reactive would solve/simplify anything here.
Any feedback/correction will be highly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions