From e9f0aaf4c2167161415b23f77eeef635644b5f70 Mon Sep 17 00:00:00 2001 From: commitimpush Date: Wed, 31 Aug 2022 12:10:58 +0200 Subject: [PATCH] added same image check --- example/lib/main.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 14b280b..e192517 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,5 +1,6 @@ import 'dart:typed_data'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_image_picker/image_picker.dart'; @@ -72,10 +73,15 @@ class _ImagePickerExampleHomePageState void pickImage() async { Uint8List? imageInBytes = await imagePicker.showPickImageDialog(context); - if (imageInBytes != null) { + if (imageInBytes != null && !listEquals(image, imageInBytes)) { setState(() { image = imageInBytes; }); + } else { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('Selected image is already being displayed!')), + ); } } }