Skip to content

Commit

Permalink
Update slider.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
fzyzcjy authored Jun 6, 2022
1 parent 9bde9b5 commit d8ef37a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion charts_flutter/example/lib/behaviors/slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class _SliderCallbackState extends State<SliderLine> {
});
}

SchedulerBinding.instance.addPostFrameCallback(rebuild);
_ambiguate(SchedulerBinding.instance)!.addPostFrameCallback(rebuild);
}

@override
Expand Down Expand Up @@ -194,3 +194,11 @@ class LinearSales {

LinearSales(this.year, this.sales);
}

/// This allows a value of type T or T?
/// to be treated as a value of type T?.
///
/// We use this so that APIs that have become
/// non-nullable can still be used with `!` and `?`
/// to support older versions of the API as well.
T? _ambiguate<T>(T? value) => value;

0 comments on commit d8ef37a

Please sign in to comment.