Skip to main content

getImageFromGallery method

Future<void> getImageFromGallery ({bool camera = false})

<p>This function is used to get the image from gallery.</p> <p>The function uses the <code>_multiMediaPickerService</code> services.</p> <p><strong>params</strong>:</p> <ul> <li><code>camera</code>: if true then open camera for image, else open gallery to select image.</li> </ul> <p><strong>returns</strong>:</p> <ul> <li><code>Future<void></code>: Getting image from gallery returns future</li> </ul>

Implementation

Future\<void\> getImageFromGallery(\{bool camera = false\}) async \{
final image =
await _multiMediaPickerService.getPhotoFromGallery(camera: camera);
if (image != null) \{
_imageFile = image;
_navigationService.showTalawaErrorSnackBar(
"Image is added",
MessageType.info,
);
notifyListeners();
\}
\}