camera method
Implementation
camera(BuildContext context) async {
if(await AppUtils.isNetConnected()) {
final XFile? photo = await _picker.pickImage(
source: ImageSource.camera);
if (photo != null) {
isImageSelected.value = true;
if(context.mounted) {
Navigator.push(context, MaterialPageRoute(builder: (con) =>
CropImage(
imageFile: File(photo.path),
))).then((value) {
value as MemoryImage;
imageBytes = value.bytes;
var name = "${DateTime
.now()
.millisecondsSinceEpoch}.jpg";
writeImageTemp(value.bytes, name).then((value) {
/*if (from.value == Routes.login) {
imagePath(value.path);
changed(true);
update();
} else {*/
imagePath(value.path);
changed(true);
updateProfileImage(
path: value.path, update: false, context: context);
// }
});
});
}
} else {
// User canceled the Camera
isImageSelected.value = false;
}
}else{
toToast(AppConstants.noInternetConnection);
}
}