Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[camera_android] Removes usage of _ambiguate method in example #4924

Merged
merged 4 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/camera/camera_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.8+9

* Removes usage of `_ambiguate` method in example.

## 0.10.8+8

* Adds pub topics to package metadata.
Expand Down
12 changes: 3 additions & 9 deletions packages/camera/camera_android/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
@override
void initState() {
super.initState();
_ambiguate(WidgetsBinding.instance)?.addObserver(this);
WidgetsBinding.instance.addObserver(this);

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

@override
void dispose() {
_ambiguate(WidgetsBinding.instance)?.removeObserver(this);
WidgetsBinding.instance.removeObserver(this);
_flashModeControlRowAnimationController.dispose();
_exposureModeControlRowAnimationController.dispose();
super.dispose();
Expand Down Expand Up @@ -580,7 +580,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
}

if (_cameras.isEmpty) {
_ambiguate(SchedulerBinding.instance)?.addPostFrameCallback((_) async {
SchedulerBinding.instance.addPostFrameCallback((_) async {
showInSnackBar('No camera found.');
});
return const Text('None');
Expand Down Expand Up @@ -1075,9 +1075,3 @@ Future<void> main() async {
}
runApp(const CameraApp());
}

/// 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 `?` on the stable branch.
T? _ambiguate<T>(T? value) => value;
2 changes: 1 addition & 1 deletion packages/camera/camera_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Android implementation of the camera plugin.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22

version: 0.10.8+8
version: 0.10.8+9

environment:
sdk: ">=2.19.0 <4.0.0"
Expand Down