getResponse method
Gets server response by task ID
requestId - task ID
Returns JSON with TaskInfo (id, status, path, registrationDate, responseJson) or null if the task is not found
Implementation
@override
Future<Map<String, dynamic>?> getResponse(String requestId) async {
try {
final result = await methodChannel.invokeMethod<Map<Object?, Object?>>(
'getResponse',
{'requestId': requestId},
);
if (result == null) {
return null;
}
return Map<String, dynamic>.from(result);
} on PlatformException catch (e) {
// If the task is not found, return null instead of throwing an error
if (e.code == 'NOT_FOUND') {
return null;
}
rethrow;
}
}