Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
[camera] Remove usage of _ambiguate method in example (#6555)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsreichardt authored Oct 20, 2022
1 parent 32b1f7b commit 09a4a09
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
5 changes: 5 additions & 0 deletions packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.10.0+4

* Removes usage of `_ambiguate` method in example.
* Updates minimum Flutter version to 3.0.

## 0.10.0+3

* Updates code for `no_leading_underscores_for_local_identifiers` lint.
Expand Down
13 changes: 3 additions & 10 deletions packages/camera/camera/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,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 @@ -102,7 +102,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 @@ -585,7 +585,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 @@ -1079,10 +1079,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.
// TODO(ianh): Remove this once we roll stable in late 2021.
T? _ambiguate<T>(T? value) => value;
2 changes: 1 addition & 1 deletion packages/camera/camera/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ publish_to: none

environment:
sdk: ">=2.14.0 <3.0.0"
flutter: ">=2.10.0"
flutter: ">=3.0.0"

dependencies:
camera:
Expand Down
4 changes: 2 additions & 2 deletions packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ description: A Flutter plugin for controlling the camera. Supports previewing
Dart.
repository: https://github.com/flutter/plugins/tree/main/packages/camera/camera
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.10.0+3
version: 0.10.0+4

environment:
sdk: ">=2.14.0 <3.0.0"
flutter: ">=2.10.0"
flutter: ">=3.0.0"

flutter:
plugin:
Expand Down

0 comments on commit 09a4a09

Please sign in to comment.