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!>
Thanks for joining our community and helping improve Syncfusion products!
While having multiple series and one of the series legend is not visible chart crashes on toggle.
Version: 18.4.43+2
Steps to reproduce
SfCartesianChart(primaryXAxis: NumericAxis(),legend: Legend(isVisible: true),
primaryYAxis: NumericAxis(),
series: [
ColumnSeries<int, int>(
dataSource: [1],
xValueMapper: (v, _) => v,
yValueMapper: (v, _) => v,
name: "First"),
ColumnSeries<int, int>(
dataSource: [2],
xValueMapper: (v, _) => v,
yValueMapper: (v, _) => v,
name: "Second legend not visible",
isVisibleInLegend: false,
),
],
);Stacktrace2021-02-22 14:26:50.538 29027-29157/app I/flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
2021-02-22 14:26:50.539 29027-29157/app I/flutter: The following RangeError was thrown building SfCartesianChart(dirty, dependencies: [MediaQuery,
2021-02-22 14:26:50.539 29027-29157/app I/flutter: _InheritedTheme, _EffectiveTickerMode, _LocalizationsScope-[GlobalKey#5953d]], state:
2021-02-22 14:26:50.539 29027-29157/app I/flutter: SfCartesianChartState#aa519(tickers: tracking 2 tickers)):
2021-02-22 14:26:50.539 29027-29157/app I/flutter: RangeError (index): Invalid value: Only valid value is 0: 1
2021-02-22 14:26:50.539 29027-29157/app I/flutter: The relevant error-causing widget was:
2021-02-22 14:26:50.539 29027-29157/app I/flutter: SfCartesianChart
2021-02-22 14:26:50.539 29027-29157/app I/flutter: When the exception was thrown, this was the stack:
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #0 List.[] (dart:core-patch/growable_array.dart:177:60)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #1 SfCartesianChartState._findVisibleSeries (package:syncfusion_flutter_charts/src/chart/base/chart_base.dart:1789:67)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #2 SfCartesianChartState.build (package:syncfusion_flutter_charts/src/chart/base/chart_base.dart:1257:5)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #3 StatefulElement.build (package:flutter/src/widgets/framework.dart:4744:28)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4627:15)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #5 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4800:11)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #6 Element.rebuild (package:flutter/src/widgets/framework.dart:4343:5)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #7 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2730:33)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #8 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:913:20)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #9 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:302:5)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #10 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #11 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1055:9)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #12 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:971:5)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #16 _invoke (dart:ui/hooks.dart:251:10)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: #17 _drawFrame (dart:ui/hooks.dart:209:3)
2021-02-22 14:26:50.539 29027-29157/app I/flutter: (elided 3 frames from dart:async)