getRequestStatus method

  1. @override
Future<Map<String, dynamic>?> getRequestStatus(
  1. String requestId
)
override

Gets task status by ID

requestId - task ID

Returns JSON with TaskInfo (id, status, path, registrationDate) or null if the task is not found

Implementation

@override
Future<Map<String, dynamic>?> getRequestStatus(String requestId) async {
  try {
    final result = await methodChannel.invokeMethod<Map<Object?, Object?>>(
      'getRequestStatus',
      {'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;
  }
}