getDisplayableData method
获取可用于显示的数据 如果是二进制数据直接返回,如果是文件路径则读取文件
Implementation
Future<Uint8List> getDisplayableData() async {
if (bytes != null) {
return bytes!;
}
if (filePath != null) {
final file = File(filePath!);
if (await file.exists()) {
return await file.readAsBytes();
}
}
throw Exception('No valid image data available');
}