requestPermissionWith method
void
requestPermissionWith(})
Implementation
void requestPermissionWith(Permission permission, bool isPicker,
{Function(List<PlatformFile> files)? callBackMultiPickerImages,
Function(List<PlatformFile> files)? callBackMultiPickerCamera,
Function(File file)? callBackPickerCamera,
Function(File file)? callBackPickerImage}) {
PermissionHelper()
.requestPermissions(
isPicker ? [Permission.mediaLibrary] : [Permission.camera])
.then((permission) async {
if (permission.isNotEmpty == true) {
if (permission[isPicker ? Permission.mediaLibrary : Permission.camera]!
.isGranted) {
if (isPicker) {
if (callBackPickerImage != null) {
await getSingleImage(callBackPickerImage: callBackPickerImage);
} else if (callBackMultiPickerImages != null) {
await getSingleImage(
callBackMultiPickerImage: callBackMultiPickerImages);
}
} else {
if (callBackPickerCamera != null) {
await getSingleCamera(callBackPickerCamera: callBackPickerCamera);
} else if (callBackMultiPickerCamera != null) {
await getSingleCamera(
callBackMultiPickerCamera: callBackMultiPickerCamera);
}
}
}
}
});
}