Skip to content

Commit 1474692

Browse files
committed
Remove assertion to check to provide only one of color or gradient property in the BarChartRodData and BackgroundBarChartRodData, imaNNeo#1121.
1 parent c5e94e5 commit 1474692

File tree

2 files changed

+5
-16
lines changed

2 files changed

+5
-16
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## newVersion
2+
* **IMPROVEMENT** (by @imaNNeo) Remove assertion to check to provide only one of `color` or `gradient` property in the [BarChartRodData](https://github.com/imaNNeo/fl_chart/blob/master/repo_files/documentations/bar_chart.md#barchartroddata) and [BackgroundBarChartRodData](https://github.com/imaNNeo/fl_chart/blob/master/repo_files/documentations/bar_chart.md#backgroundbarchartroddata), #1121.
3+
14
## 0.60.0
25
* **IMPROVEMENT** (by @lsaudon) Replace flutter_lints by very_good_analysis
36
* **BREAKING** (by @lsaudon) Update dart sdk to 2.17.0 (flutter 3.0.0)

lib/src/chart/bar_chart/bar_chart_data.dart

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,7 @@ class BarChartRodData with EquatableMixin {
333333
borderRadius = Utils().normalizeBorderRadius(borderRadius, width ?? 8),
334334
borderSide = Utils().normalizeBorderSide(borderSide, width ?? 8),
335335
backDrawRodData = backDrawRodData ?? BackgroundBarChartRodData(),
336-
rodStackItems = rodStackItems ?? const [] {
337-
assert(
338-
(gradient == null && this.color != null) ||
339-
(this.color == null && gradient != null),
340-
'You cannot provide both color and gradient at the same time, '
341-
'color is ${this.color} and gradient is $gradient',
342-
);
343-
}
336+
rodStackItems = rodStackItems ?? const [];
344337

345338
/// [BarChart] renders rods vertically from [fromY].
346339
final double fromY;
@@ -533,14 +526,7 @@ class BackgroundBarChartRodData with EquatableMixin {
533526
toY = toY ?? 0,
534527
show = show ?? false,
535528
color = color ??
536-
((color == null && gradient == null) ? Colors.blueGrey : null) {
537-
assert(
538-
(gradient == null && this.color != null) ||
539-
(this.color == null && gradient != null),
540-
'You cannot provide both color and gradient at the same time, '
541-
'color is ${this.color} and gradient is $gradient',
542-
);
543-
}
529+
((color == null && gradient == null) ? Colors.blueGrey : null);
544530

545531
/// Determines to show or hide this
546532
final bool show;

0 commit comments

Comments
 (0)