File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
packages/graphql_flutter/lib/src/widgets Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 1010 - uses : subosito/flutter-action@v1
1111 with :
1212 channel : ' stable'
13- flutter-version : ' 2.10.5'
1413 - run : make dep
1514 - run : make ci_fmt_flutter
Original file line number Diff line number Diff line change @@ -20,11 +20,19 @@ class _CacheProviderState extends State<CacheProvider>
2020 with WidgetsBindingObserver {
2121 GraphQLClient ? client;
2222
23+ /// This allows a value of type T or T?
24+ /// to be treated as a value of type T?.
25+ ///
26+ /// We use this so that APIs that have become
27+ /// non-nullable can still be used with `!` and `?`
28+ /// to support older versions of the API as well.
29+ T ? _ambiguate <T >(T ? value) => value;
30+
2331 @override
2432 void initState () {
2533 super .initState ();
2634
27- WidgetsBinding .instance! .addObserver (this );
35+ _ambiguate ( WidgetsBinding .instance) ! .addObserver (this );
2836 }
2937
3038 @override
@@ -42,7 +50,7 @@ class _CacheProviderState extends State<CacheProvider>
4250 void dispose () {
4351 super .dispose ();
4452
45- WidgetsBinding .instance! .removeObserver (this );
53+ _ambiguate ( WidgetsBinding .instance) ! .removeObserver (this );
4654 }
4755
4856/*
You can’t perform that action at this time.
0 commit comments