getEditedImage method
Implementation
Future<Uint8List> getEditedImage() async {
if (kIsWeb) {
return _saveImageOnWeb(renderRepaintKey: _renderRepaintKey);
}
// Calculate text sizes on UI thread
final dateSting = DateFormat('dd MMM, yyyy HH:mm').format(dateTime);
final dateStringWidth = getTextSize(dateSting).width;
String? locationSting;
double? locationStringWidth;
if (locationData != null) {
locationSting = '${locationData!.latitude}, ${locationData!.longitude}';
locationStringWidth = getTextSize(locationSting).width;
}
print('Starting image processing in isolate...');
try {
final result = await compute(ImageProcessor.processImage, {
'path': imageFile.path,
'dateTime': dateTime.toIso8601String(),
'locationData': locationData != null
? {
'latitude': locationData!.latitude,
'longitude': locationData!.longitude,
}
: null,
'angleForText': _angleForText,
'dateStringWidth': dateStringWidth,
'locationStringWidth': locationStringWidth,
});
print('Image processing completed, result length: ${result.length}');
return result;
} catch (e, stack) {
print('Error in image processing: $e');
print('Stack trace: $stack');
rethrow;
}
}