fix: Ambiguation is not needed in render box anymore (#2711)

Since we are requiring a SDK higher than when the instance could be null we don't need to do the ambiguate call anymore.
This commit is contained in:
Lukas Klingsbo
2023-09-10 15:50:15 +02:00
committed by GitHub
parent 93dcb3a117
commit b3d78f5883

View File

@ -131,11 +131,11 @@ class GameRenderBox extends RenderBox with WidgetsBindingObserver {
}
void _bindLifecycleListener() {
_ambiguate(WidgetsBinding.instance)!.addObserver(this);
WidgetsBinding.instance.addObserver(this);
}
void _unbindLifecycleListener() {
_ambiguate(WidgetsBinding.instance)!.removeObserver(this);
WidgetsBinding.instance.removeObserver(this);
}
@override
@ -143,13 +143,3 @@ class GameRenderBox extends RenderBox with WidgetsBindingObserver {
game.lifecycleStateChange(state);
}
}
/// 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.
///
/// See more: https://docs.flutter.dev/development/tools/sdk/release-notes/release-notes-3.0.0
T? _ambiguate<T>(T? value) => value;