getStreamUploadRequestById method

  1. @override
Future<StreamUploadRequest?> getStreamUploadRequestById(
  1. String id
)
override

Implementation

@override
Future<StreamUploadRequest?> getStreamUploadRequestById(String id) async {
  try {
    final jsonString = await methodChannel.invokeMethod<String>(
      'getStreamUploadRequestById',
      {'id': id},
    );
    if (jsonString == null || jsonString == '{}') {
      return null;
    }

    final jsonData = jsonDecode(jsonString) as Map<String, dynamic>;
    return StreamUploadRequest.fromJson(jsonData);
  } on PlatformException catch (e) {
    throw PlatformException(
      code: 'STREAM_REQUEST_ERROR',
      message: e.message,
      details: e.toString(),
    );
  }
}