fl_chart iOS, the line icon crashes when displaying data after the program starts, while it displays normally under Android

129 Views Asked by At
List<FlSpot> spots = []; for (int i = 0; i < datas!.length; i++) { // spots.add(FlSpot(1, 50));
if (datas![i].strength == null) {
    spots.add(FlSpot.nullSpot);
  } else {
    var value = double.parse(datas![i].strength!).abs();
    spots.add(FlSpot(i.toDouble(), value));
  }
}
final LineChartBarData lineChartBarData1 = LineChartBarData(
  spots: spots,
  shadow: const Shadow(color: CMColor.blueColor), 
  isCurved: true,
  gradient: getGradient2(CMColor.blueColor,
  const Color(0xFF5076AD)), 
  barWidth: 3, 
  isStrokeCapRound: true, 
  dotData: const FlDotData( show: false, ), 
  belowBarData: BarAreaData( show: true, 
  gradient: getGradient2(CMColor.blueColor.withOpacity(0.3), const       Color(0xFF5076AD).withOpacity(0.3))
  ), 
);

When the "spots" array is empty, the program runs normally

When there is data, the program will experience a thread crash on the first load of data

If no data is added during the startup process and the UI loads normally, the program will start normally

After refreshing the UI during hot loading, it can be displayed normally

The crash information is as follows:

thread #10, name = 'io.flutter.1.raster', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x00000001049888e0 Flutter`impeller::ContentsFilterInput::GetCoverage(impeller::Entity const&) const + 4
Flutter`impeller::ContentsFilterInput::GetCoverage:
0x1049888e0 <+4>: ldr x9, [x0]
0x1049888e4 <+8>: ldr x2, [x9, #0x18]
0x1049888e8 <+12>: br x2
Flutter`impeller::FilterContentsFilterInput::~FilterContentsFilterInput:
0x1049888ec <+0>: stp x20, x19, [sp, #-0x20]!
Target 0: (Runner) stopped.
Lost connection to device.

I tried using [FlSpot (0.0, 51.3), FlSpot (1.0, 66.5), FlSpot (2.0, 77.8), FlSpot (3.0, 51.3), FlSpot (4.0, 66.5)] as the data source, so it can be displayed normally

But using 'spots' as a data source will crash

I can't see the difference between these two data sources, I don't know what the reason is?

enter image description here

enter image description here

I can't see any difference between the data source I converted and the data source used for testing, but using the converted one crashes I don't know why?

0

There are 0 best solutions below