I know how to check image width and height:
import 'dart:io'; File image = new File('image.png'); // Or any other way to get a File instance. var decodedImage = await decodeImageFromList(image.readAsBytesSync()); print(decodedImage.width); print(decodedImage.height)
But I want to check the image size like 100kb, 200kb, or something like that is there any way, please help me.
final bytes = image.readAsBytesSync().lengthInBytes; final kb = bytes / 1024; final mb = kb / 1024;
If you want to
final bytes = (await image.readAsBytes()).lengthInBytes;
Answered By – iDecode
Answer Checked By – Robin (FlutterFixes Admin)