pubnub / dart

PubNub Dart SDK
Other
27 stars 15 forks source link

Uploading file in channel throws exception #61

Closed rahulrmishra closed 3 years ago

rahulrmishra commented 3 years ago

I need to send a file to a channel but I am not able to figure out how to do it.

First I select the file then I do,

Uint8List fileContent = await selectedFile.readAsBytes(); await pubnub.files.sendFile(channelId, 'smiley.jpg', fileContent );

But I get an error saying PubNubException: request failed (HttpException: HTTP headers are not mutable).

are commented 3 years ago

Hello! What version of the SDK are you using?

rahulrmishra commented 3 years ago

Hey, this is the version - pubnub: ^3.2.0

rahulrmishra commented 3 years ago

Can you check if this is a bug or am I implementing it the wrong way?

mohitpubnub commented 3 years ago

Have you tried using version pubnub: ^4.0.0-beta.1 ?

rahulrmishra commented 3 years ago

Have you tried using version pubnub: ^4.0.0-beta.1 ?

My flutter version is - Flutter 1.22.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9b2d32b605 (6 months ago) • 2021-01-22 14:36:39 -0800 Engine • revision 2f0af37152 Tools • Dart 2.10.5

So I'm getting conflicts while using the 4.0.0-beta, and I cannot migrate it to flutter 2 right now

are commented 3 years ago

We encourage you to migrate to Flutter 2. You don't need to use Null Safety or change your code for this. You can use the latest Flutter and Dart versions and disable the Null Safety. This will allow you to use latest versions of the libraries but migrate your code when you have time to do so.

rahulrmishra commented 3 years ago

I migrated to Flutter 2 and started using pubnub: ^4.0.0-beta.1 and now I don't get the exception.