i am trying to encode image to base64 to send to server. the base 64 string i am getting from image is not valid.
i can display image captured from camera. its not encoding to base64 properly.
File img;
void getPic() async {
img = await ImagePicker.pickImage(source: ImageSource.camera);
if (img != null) {
print(img);
List<int> imageBytes = await img.readAsBytes();
base64Image = base64Encode(imageBytes);
print(base64Image);
setState(() => base64Image);
}
}