Flutter real time line chart - Data from Streambuilder

Hello,

I was looking for some last touches on the real time chart. I am assuming the changes lie in the _updateDataSource method. 

The original question was asked on Stackoverflow, I was directed to ask here for further help. 

I have modified the example provided to accommodate within my source, but I am still a bit behind. 

The variable value has the data that the stream builder updates every second, which needs to be taken instead of the randomInt. 

Any help here please. 


Attachment: reading.dart_757c6e05.zip

3 Replies 1 reply marked as answer

DP Dharanitharan Palanisamy Syncfusion Team July 9, 2021 06:59 AM UTC

Hi Vivian, 
 
Greetings from the Syncfusion team. We looked at your question and the code you provided and came up with the following solution. We like to point out that we cannot be able to run your code because it has so many dependencies, but we did evaluate it and found that you are attempting to generate the chart without data. The getBPM() method is called in the _updateDataSource method, but the value is set in the build method in another stream controller. As a result, for your situation, we recommend using the nested StreamBuilder. We have included a sample with two stream builders: one is for updating the y value of the data alone, like in your example, and the other is for building the chart with that data in the nested stream builder, which works as expected. In your example, the value you are getting in the stream builder is a Bluetooth function, so bind the Parent stream builder as a Bluetooth function, and after getting the data in the child stream builder, you can render the chart, which will solve your problem. Please use the accompanying sample as a guide for your case, and please revert us if you require any additional assistance. 
 
 
Thanks, 
Dharanitharan. P   


Marked as answer

VL Vivian Lobo July 9, 2021 07:01 AM UTC

Thanks for this Dharanitharan,


This solved my issue and I am grateful for t



DP Dharanitharan Palanisamy Syncfusion Team July 9, 2021 03:52 PM UTC

Hi Vivian, 
  
Most Welcome and thanks for the revert. Please revert us if you need any further assistance on this and we are always happy to assist you. 
  
Thanks, 
Dharanitharan. P 


Loader.
Up arrow icon