Open AmirHosseinBaderan opened 7 months ago
i want to send an IAsyncEnumerable to server for streaming and i used multiple of types that all of them not working my question is : how do i do it?
the code i wrote :
Future<FileResponse<FtmFile?>> upload(UploadFile file) async { try { await start(); final request = await _uploadRequest(RequestUpload.fromUploadFile(file)); if (request.status.toLowerCase() == 'success') { final base64 = base64Encode(file.buffer); final subject = Stream.fromIterable(_makeChunck(base64)); final response = await _connection?.invoke(_FileMethods.upload, args: [ request.result!, subject, ]); return FileResponse<FtmFile?>.fromJson( response as Map<String, Object?>); } else { return FileResponse( result: null, status: request.status, ); } } catch (e) { return FileResponse( result: null, status: 'fail', ); } finally { await _connection?.stop(); } }
the error i get : RangeError (RangeError (index): Invalid value: Valid value range is empty: 1)
i want to send an IAsyncEnumerable to server for streaming and i used multiple of types that all of them not working my question is : how do i do it?
the code i wrote :
the error i get : RangeError (RangeError (index): Invalid value: Valid value range is empty: 1)