Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Update chart_container.dart #739

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions charts_flutter/lib/src/chart_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ class ChartContainerRenderObject<D> extends RenderCustomPaint

// Sometimes chart behaviors try to draw the chart outside of a Flutter draw
// cycle. Schedule a frame manually to handle these cases.
if (!SchedulerBinding.instance!.hasScheduledFrame) {
SchedulerBinding.instance!.scheduleFrame();
if (!SchedulerBinding.instance.hasScheduledFrame) {
SchedulerBinding.instance.scheduleFrame();
}

SchedulerBinding.instance!.addPostFrameCallback(startAnimationController);
SchedulerBinding.instance.addPostFrameCallback(startAnimationController);
}

/// Request Flutter to rebuild the widget/container of chart.
Expand All @@ -229,7 +229,7 @@ class ChartContainerRenderObject<D> extends RenderCustomPaint
// This is needed to request rebuild after the legend has been added in the
// post process phase of the chart, which happens during the chart widget's
// build cycle.
SchedulerBinding.instance!.addPostFrameCallback(doRebuild);
SchedulerBinding.instance.addPostFrameCallback(doRebuild);
}

/// When Flutter's markNeedsLayout is called, layout and paint are both
Expand Down