Skip to content

Commit ff4e505

Browse files
committed
[various] Prepare plugin repo for binding API improvements
Since plugins also have to work with the stable branch, we can't actually take advantage of the changes right away, so we muddle the issue in the meantime. Prep for flutter/flutter#83843 See also flutter#4136, flutter#4137
1 parent 06fc7d1 commit ff4e505

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

packages/camera/camera/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.8.2
2+
3+
* Silenced warnings that may occur during build when using a very
4+
recent version of Flutter relating to null safety.
5+
16
## 0.8.1+3
27

38
* Do not change camera orientation when iOS device is flat.

packages/camera/camera/example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
9898

9999
@override
100100
void dispose() {
101-
WidgetsBinding.instance?.removeObserver(this);
101+
_ambiguate(WidgetsBinding.instance)?.removeObserver(this);
102102
_flashModeControlRowAnimationController.dispose();
103103
_exposureModeControlRowAnimationController.dispose();
104104
super.dispose();

packages/camera/camera/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A Flutter plugin for getting information about and controlling the
44
and streaming image buffers to dart.
55
repository: https://github.com/flutter/plugins/tree/master/packages/camera/camera
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
7-
version: 0.8.1+3
7+
version: 0.8.2
88

99
environment:
1010
sdk: ">=2.12.0 <3.0.0"

packages/video_player/video_player/test/video_player_test.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,16 @@ class FakeEventsChannel {
856856
}
857857

858858
void _sendMessage(ByteData data) {
859-
ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage(
860-
eventsMethodChannel.name, data, (ByteData? data) {});
859+
_ambiguate(ServicesBinding.instance)!
860+
.defaultBinaryMessenger
861+
.handlePlatformMessage(
862+
eventsMethodChannel.name, data, (ByteData? data) {});
861863
}
862864
}
865+
866+
/// This allows a value of type T or T? to be treated as a value of type T?.
867+
///
868+
/// We use this so that APIs that have become non-nullable can still be used
869+
/// with `!` and `?` on the stable branch.
870+
// TODO(ianh): Remove this once we roll stable in late 2021.
871+
T? _ambiguate<T>(T? value) => value;

0 commit comments

Comments
 (0)