File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,14 @@ import 'package:custom_refresh_indicator/custom_refresh_indicator.dart';
55import 'package:flutter/rendering.dart' ;
66import 'package:flutter/scheduler.dart' ;
77
8+ /// This allows a value of type T or T?
9+ /// to be treated as a value of type T?.
10+ ///
11+ /// We use this so that APIs that have become
12+ /// non-nullable can still be used with `!` and `?`
13+ /// to support older versions of the API as well.
14+ T ? _ambiguate <T >(T ? value) => value;
15+
816enum WarpAnimationState {
917 stopped,
1018 playing,
@@ -163,7 +171,7 @@ class _WarpIndicatorState extends State<WarpIndicator>
163171 child: Builder (builder: (context) {
164172 if (shakeController.value == 1.0 &&
165173 _state == WarpAnimationState .playing) {
166- SchedulerBinding .instance
174+ _ambiguate ( SchedulerBinding .instance) !
167175 .addPostFrameCallback ((_) => _resetShakeAnimation ());
168176 }
169177 return Transform .rotate (
@@ -303,6 +311,7 @@ class Sky extends CustomPainter {
303311
304312 @override
305313 bool shouldRepaint (Sky oldDelegate) => true ;
314+
306315 @override
307316 bool shouldRebuildSemantics (Sky oldDelegate) => false ;
308317}
Original file line number Diff line number Diff line change 11part of custom_refresh_indicator;
22
3+ /// This allows a value of type T or T?
4+ /// to be treated as a value of type T?.
5+ ///
6+ /// We use this so that APIs that have become
7+ /// non-nullable can still be used with `!` and `?`
8+ /// to support older versions of the API as well.
9+ T ? _ambiguate <T >(T ? value) => value;
10+
311typedef IndicatorBuilder = Widget Function (
412 BuildContext context,
513 Widget child,
@@ -206,7 +214,7 @@ class CustomRefreshIndicatorState extends State<CustomRefreshIndicator>
206214
207215 if (_canStart) setIndicatorState (IndicatorState .dragging);
208216
209- WidgetsBinding .instance.addPostFrameCallback ((_) {
217+ _ambiguate ( WidgetsBinding .instance) ! .addPostFrameCallback ((_) {
210218 controller.setAxisDirection (notification.metrics.axisDirection);
211219 });
212220
You can’t perform that action at this time.
0 commit comments