diff --git a/CHANGELOG.md b/CHANGELOG.md index c13601d..9290afa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [2.0.1] - 5/05/2019 + +* fix a crash when poping a route with the camera preview + ## [2.0.0] - 2/05/2019 * We now forward the result from firebase_ml_vision for onResult diff --git a/example/pubspec.lock b/example/pubspec.lock index 69b3467..25eab6d 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -70,7 +70,7 @@ packages: path: ".." relative: true source: path - version: "2.0.0" + version: "2.0.1" flutter_test: dependency: "direct dev" description: flutter diff --git a/lib/flutter_camera_ml_vision.dart b/lib/flutter_camera_ml_vision.dart index e2eeed7..8026a80 100644 --- a/lib/flutter_camera_ml_vision.dart +++ b/lib/flutter_camera_ml_vision.dart @@ -91,10 +91,12 @@ class CameraMlVisionState extends State> { } } - Future _stop(bool silently) async { - if (_cameraController.value.isStreamingImages) { - await _cameraController.stopImageStream(); - } + void _stop(bool silently) { + Future.microtask(() async { + if (_cameraController?.value?.isStreamingImages == true && mounted) { + await _cameraController.stopImageStream(); + } + }); if (silently) { _isStreaming = false; diff --git a/pubspec.yaml b/pubspec.yaml index a6bae1c..8ef1ee0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_camera_ml_vision 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... -version: 2.0.0 +version: 2.0.1 authors: - Jimmy Aumard - Rushio Consulting