From 579669e865cf8f0e23f8e2c343064882d235b22b Mon Sep 17 00:00:00 2001 From: joyhope Date: Tue, 17 May 2022 22:13:48 +0800 Subject: [PATCH] solve the warning --- charts_flutter/example/lib/behaviors/slider.dart | 2 +- charts_flutter/lib/src/chart_container.dart | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/charts_flutter/example/lib/behaviors/slider.dart b/charts_flutter/example/lib/behaviors/slider.dart index df45c6b04..6b7541011 100644 --- a/charts_flutter/example/lib/behaviors/slider.dart +++ b/charts_flutter/example/lib/behaviors/slider.dart @@ -119,7 +119,7 @@ class _SliderCallbackState extends State { }); } - SchedulerBinding.instance!.addPostFrameCallback(rebuild); + SchedulerBinding.instance.addPostFrameCallback(rebuild); } @override diff --git a/charts_flutter/lib/src/chart_container.dart b/charts_flutter/lib/src/chart_container.dart index b10f5333a..45f970e43 100644 --- a/charts_flutter/lib/src/chart_container.dart +++ b/charts_flutter/lib/src/chart_container.dart @@ -202,11 +202,11 @@ class ChartContainerRenderObject 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. @@ -229,7 +229,7 @@ class ChartContainerRenderObject 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