i'm struggling to find a solution to my issue, i hope you guys can help.
in (PAGE 1) i have Streambuilder and i'm forwarding data to (PAGE 2) through the constructor and then to (PAGE 3).
now (PAGE 1 receives stream of live data that updates whenever changes occur.
the problem here the data in (PAGE 2 & 3) don't listen to those updates.
now how can i make those data listen to updates. taking into account index is involved when passing those data.
NOTE: i'm using Getx for state management
thank you.
i can't find a way that works when index is involved
Yes, you can solve that problem, rather than using StreamBuilder you can use Rx and Obx for continuous updates.
I provide you steps to start to implement like below:
Step 1: create a controller and add any variable using the Rx keyword.
Step 2: use the Obx widget where you want to listen to continuous updates.
now all three pages have an Obx widget so when you change the value, it listens on all three widgets.
Related
I have created a listview with tiles containing title and buy price and sell price (Text widgets).I build the list view from Rest API call and initially all the price values of every tile will be set to zero. then, I call SSE and receive live data for the price values.what I am trying to define is, only the price values(Title will remain static) of every tiles should be constantly updated. does the listview of the flutter support this kind of action ? I am new to flutter.can somebody help me by answering if it is possible ?
if so how to do it (a general idea).
Thanks in advance!
It depends on you, what are the components you want to change.
A simple approach is to update the list(not listview) by which you are populating the listtiles inside listview and then call the setState.
You can update the list by changing the cost of each item of your custom data type in the list or you can also change the complete list item (possibly this is not required in question).
I have been using the PaginatedDataTable widget in flutter and am looking to add a search bar to filter down the rows based on the input
However there is no clear way to do this; most tutorials only show sorting the columns.
When I modify the RowData object that's passed into the source input of the table nothing happens.
Does anyone have any tips on what I'm missing?
Many thanks in advance.
Perhaps you are missing a notifyListeners after changing the data source?
Call this method whenever the object changes, to notify any clients the object may have changed. Listeners that are added during this iteration will not be visited. Listeners that are removed during this iteration will not be visited after they are removed.
Im working on a SDUI (Server driven UI) using Flutter,
In Runtime I receive JSON data, which parsed into set of widgets and set of map variable
I want to bind some of the key value pair of new map state to UI, State-fully ( meaning UI repaints corresponding widget if variable changes). further Map values may get modified locally, or from the server. And also cant predict which map variables to be monitored by state management at the compile time (JSON data tells this in runtime).
Can someone suggest right State management plugin (Mobx, Provider, etc) suitable for this kind of SDUI scenario
Or is it possible to do this without state management plugin with just flutter? any example available for this?
I'm using a Streambuilder to a Firestore instance stream to fetch some "Appointments" which I later modify (delete / add / update).
Problem is that each time I modify the date on one, each item reloads (because the StreamBuilder builds a list of the appointments)
I was thinking that something like giving each appointment it's own streambuilder? but that sounds stupid.
What would be a general solid approach to these types of issues , that I can later use in my future apps ?
You will want to use the ListView.builder() named constructor. It takes a property itemCount: which can be your list such as itemCount: items.length.
This will build the list based on the items currently in your list (firestore in your case).
It will build the list items conditionally as it needs them.
When you bind to a Kendo UI Grid with MVVM, databound will fire once and all is well. If you need to update that data after the fact, every time you change one piece of data on any viewmodel (or child viewmodel), the entire grid re-databinds. Thus, if you had some cell in the grid that is bound to a template and you have to change 2 or 3 properties on the viewmodel from some external ajax source, Databound will fire 2 or 3 times for each model that is changed, causing the entire viewable area to rebind. How can we update lots of data at once and only have databound fire once?
How exactly you rebind the Grid? Basically if you change some of the models like this:
dataItem.set('SomeField','new value');
dataItem.set('someOtherField','other value');
This way the Grid will be indeed bound two times because of the MVVM. The change event is triggered each time you call set.
However if you update the values like this:
dataItem.SomeField='new value';
dataItem.someOtherField= 'other value';
The Grid wont react to the change and wont rebind re-read the values from the models you can force the Grid to do it through the refresh method.
$('#gridName').data().kendoGrid.refresh()
I'm not sure if there is some way to temporarily tell the grid to stop listening to events and then at the end, re-sync once. If there is, please give that answer here! Otherwise, what I did instead is I didn't go through .set() for each item. Instead, I updated the data for all the rows by setting the data directly to the property. Then when I got to the very last row I was updating, I called .set() on the last property that needed to be updated. This will cause databound to fire only once and the entire grid will refresh itself with all the data that was changed. If you don't do it this way, then the more rows displayed on the page, the longer it takes to process. (It could take 20+ seconds before the user can do anything again.)
It looks like the dataBinding event is where you can prevent a rebind on the grid.
Telerik Online Docs