From 1ec1861ba269f082685505e3edd4f0e341ec49ee Mon Sep 17 00:00:00 2001 From: commitimpush Date: Mon, 5 Sep 2022 09:21:35 +0200 Subject: [PATCH] Solved the flutter analyze errors --- .flutter-plugins-dependencies | 2 +- .gitignore | 1 + example/lib/main.dart | 3 ++- lib/src/ui/image_picker_ui.dart | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 1ac0fd8..8079122 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker_ios","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_ios-0.8.5+6\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.7\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_android-0.8.5+2\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"image_picker_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.1.8\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]}],"date_created":"2022-09-05 08:55:11.890091","version":"3.0.5"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"image_picker_ios","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_ios-0.8.5+6\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.7\\\\","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_android-0.8.5+2\\\\","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]}],"macos":[],"linux":[],"windows":[],"web":[{"name":"image_picker_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.1.8\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]}],"date_created":"2022-09-05 09:08:26.322276","version":"3.0.5"} \ No newline at end of file diff --git a/.gitignore b/.gitignore index d920ae6..7501b90 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ migrate_working_dir/ .dart_tool/ .packages build/ +coverage/ diff --git a/example/lib/main.dart b/example/lib/main.dart index cb536af..8560bc5 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -97,7 +97,8 @@ class _ImagePickerExampleHomePageState /// When the same image is chosen there will be a snackbar popping up to let you know it's already being displayed. void pickImage() async { Uint8List? imageInBytes = await showModalBottomSheet( - context: context, builder: (BuildContext context) => ImagePicker()); + context: context, + builder: (BuildContext context) => const ImagePicker()); if (imageInBytes != null) { if (!listEquals(image, imageInBytes)) { setState(() { diff --git a/lib/src/ui/image_picker_ui.dart b/lib/src/ui/image_picker_ui.dart index ec27460..5314fae 100644 --- a/lib/src/ui/image_picker_ui.dart +++ b/lib/src/ui/image_picker_ui.dart @@ -86,9 +86,10 @@ class ImagePicker extends StatelessWidget { icon: Icon(icon), iconSize: imagePickerTheme.iconSize, onPressed: () async { + final navigator = Navigator.of(context); var image = await (imagePickerService ?? ImagePickerService()) .pickImage(imageSource); - Navigator.of(context).pop(image); + navigator.pop(image); }, ), Text(