Welcome to the Flutter feedback portal. We’re happy you’re here! If you have feedback on how to improve the Flutter, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

print("dataSource before $dataSource");
var startIndex=dataSource.indexWhere(
(element) => element.datetime.millisecondsSinceEpoch >
list.first.datetime.millisecondsSinceEpoch);

var endIndex=dataSource.indexWhere(
(element) => element.datetime.millisecondsSinceEpoch >
list.last.datetime.millisecondsSinceEpoch);
dataSource.replaceRange(startIndex, endIndex, list);

int updatedCount = endIndex - startIndex;
int addedCount = list.length - updatedCount;

List<int> updatedDataIndexes = List.generate(updatedCount+1, (i) => startIndex + i);
List<int> addedDataIndexes = List.generate(addedCount, (i) => startIndex + updatedCount + i+1);
print("updatedDataIndexes $updatedDataIndexes");
print("addedDataIndexes $addedDataIndexes");
print("dataSource after $dataSource");
_controller?.updateDataSource(
updatedDataIndexes: updatedDataIndexes,
addedDataIndexes: addedDataIndexes,
);

OUTPUT:

dataSource before [value: 4.0, value: 6.0, value: 8.0, value: 10.0, value: 12.0, value: 14.0]

updatedDataIndexes [2, 3, 4, 5]

addedDataIndexes [6, 7, 8, 9]

dataSource after [value: 4.0, value: 6.0, value: 30.0, value: 40.0, value: 50.0, value: 60.0, value: 65.0, value: 68.0, value: 69.0, value: 14.0]


so it's look good if i understood it corectly, second index value change from 8 to 30...5th index value change from 14 to 60 and 4 new index added

the problem is that in UI chart after this data source changing loos first value