Closed Julyyq closed 4 years ago
I solve the problem, seems that there is a bug of attaching Map data to the event.
Is it solved? I need a sample example in flutter using EventBus in different widget class (Other than main), that would be a great for flutter people.
Reopening this because there seems to be an issue (also see #16), although I don't quite understand it yet. If someone could clarify, it would be great.
@marcojakob My problem is that passing Map
type data to the listener, the listener function cannot be called.
Reopening this because there seems to be an issue (also see #16), although I don't quite understand it yet. If someone could clarify, it would be great.
@marcojakob , Why is it opened if it is not clear that #16 has same issue than this?
@JordyBaylac Do you also have an issue with event bus and flutter?
Is it solved? I need a sample example in flutter using EventBus in different widget class (Other than main), that would be a great for flutter people.
@marcojakob can you give example?
@marcojakob no I am not having any issue so far.
Is it solved? I need a sample example in flutter using EventBus in different widget class (Other than main), that would be a great for flutter people.
@marcojakob can you give example?
No actually, i misunderstood flutter flow that's why i needed event-bus then, now we are just following simple pattern, event bus is needed for particular scenarios, at present we are not using it. Thanks for your support.
I'll close this since the problem seems to not be the event bus but something else.
I am also facing the same issue. I am also firing one event on message from Firebase. The listener is another screen which is pushed over the screen which is actually sending the event.
Strange enough, if I send event from screen A to Screen B (screen B is a BottomNavigationBarItem) it works. But if screen B is another screen which is pushed onto screen A, it does not work.
Above the author said it does not support Map data. But I am sending basic int
data. That also seems not to work.
@uchiha-itachi95 Please check that you are using the same instance of your EventBus.
@marcojakob I am facing the same issue with the latest version. The data is being intermittently gathered. I have a similar scenario: I have an event bus listener on page A
(where it works fine). And now I have 1-2 pages stacked or pushed over page A
. And I have an same instance event bus listener which listens to the same event in page B
(which gets data intermittently). Hope this will get a fix or a solution(work around).
In my "HomePage"
initState
function, I place the following code for listening toNewOrderEvent
:These code works fine and in
main.dart
file, I invokeeventBus.fire(new NewOrderEvent("some data");
when my app receive message from Firebase Cloud Message, theeventBus.fire
function is indeed be invoked, but the listen callback function not be called.This is my "eventbus.dart" file content:
I print the
firing eventBus object
andlistening eventBus object
:They are indeed the same object.
BTW, the following are property and methods of the eventBus object: