Skip to content

Commit d4e2454

Browse files
[camera_android] Removes usage of _ambiguate method in example (flutter#4924)
Since the minimum Flutter version for this package is +3.0, we can remove the `_ambiguate` method. Part of flutter/flutter#111841
1 parent a26d8a8 commit d4e2454

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

packages/camera/camera_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.10.8+9
2+
3+
* Removes usage of `_ambiguate` method in example.
4+
15
## 0.10.8+8
26

37
* Adds pub topics to package metadata.

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
7575
@override
7676
void initState() {
7777
super.initState();
78-
_ambiguate(WidgetsBinding.instance)?.addObserver(this);
78+
WidgetsBinding.instance.addObserver(this);
7979

8080
_flashModeControlRowAnimationController = AnimationController(
8181
duration: const Duration(milliseconds: 300),
@@ -105,7 +105,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
105105

106106
@override
107107
void dispose() {
108-
_ambiguate(WidgetsBinding.instance)?.removeObserver(this);
108+
WidgetsBinding.instance.removeObserver(this);
109109
_flashModeControlRowAnimationController.dispose();
110110
_exposureModeControlRowAnimationController.dispose();
111111
super.dispose();
@@ -580,7 +580,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
580580
}
581581

582582
if (_cameras.isEmpty) {
583-
_ambiguate(SchedulerBinding.instance)?.addPostFrameCallback((_) async {
583+
SchedulerBinding.instance.addPostFrameCallback((_) async {
584584
showInSnackBar('No camera found.');
585585
});
586586
return const Text('None');
@@ -1075,9 +1075,3 @@ Future<void> main() async {
10751075
}
10761076
runApp(const CameraApp());
10771077
}
1078-
1079-
/// This allows a value of type T or T? to be treated as a value of type T?.
1080-
///
1081-
/// We use this so that APIs that have become non-nullable can still be used
1082-
/// with `!` and `?` on the stable branch.
1083-
T? _ambiguate<T>(T? value) => value;

packages/camera/camera_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Android implementation of the camera plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
55

6-
version: 0.10.8+8
6+
version: 0.10.8+9
77

88
environment:
99
sdk: ">=2.19.0 <4.0.0"

0 commit comments

Comments
 (0)