loadImageBytes function
Implementation
Future<Uint8List> loadImageBytes(String imagePath) async {
if (imagePath.isEmpty) {
throw ArgumentError('imagePath is empty');
}
if (imagePath.startsWith('data:image')) {
final base64Data = imagePath.split(',').last;
return base64Decode(base64Data);
}
return loadImageBytesFromPath(imagePath);
}