pickImage method
open image pickerfrom camera, galary, or cancel the selection
Implementation
void pickImage(int type) async {
Map<Permission, PermissionStatus> statuses = await [
Permission.camera,
Permission.storage,
].request();
if (statuses.containsValue(PermissionStatus.denied)) {
log('no permission');
} else {
final result = await ImagePicker().pickImage(
imageQuality: 70,
maxWidth: 1440,
source: type == 1 ? ImageSource.camera : ImageSource.gallery,
);
if (result != null) {
widget.handleImageSelect(result);
print(result.path);
} else {
// User canceled the picker
}
}
}