Skip to content

Commit 6fb9a2d

Browse files
fix crash when poping a route with the camera preview (#32)
1 parent 72c20e3 commit 6fb9a2d

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [2.0.1] - 5/05/2019
2+
3+
* fix a crash when poping a route with the camera preview
4+
15
## [2.0.0] - 2/05/2019
26

37
* We now forward the result from firebase_ml_vision for onResult

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ packages:
7070
path: ".."
7171
relative: true
7272
source: path
73-
version: "2.0.0"
73+
version: "2.0.1"
7474
flutter_test:
7575
dependency: "direct dev"
7676
description: flutter

lib/flutter_camera_ml_vision.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ class CameraMlVisionState<T> extends State<CameraMlVision<T>> {
9191
}
9292
}
9393

94-
Future<void> _stop(bool silently) async {
95-
if (_cameraController.value.isStreamingImages) {
96-
await _cameraController.stopImageStream();
97-
}
94+
void _stop(bool silently) {
95+
Future.microtask(() async {
96+
if (_cameraController?.value?.isStreamingImages == true && mounted) {
97+
await _cameraController.stopImageStream();
98+
}
99+
});
98100

99101
if (silently) {
100102
_isStreaming = false;

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_camera_ml_vision
22
description: A flutter widget that show the camera stream and allow ML vision recognition on it, it allow you to detect barcodes, labels, text, faces...
3-
version: 2.0.0
3+
version: 2.0.1
44
authors:
55
- Jimmy Aumard <[email protected]>
66
- Rushio Consulting <[email protected]>

0 commit comments

Comments
 (0)