AS-Devs / signalr_flutter

A flutter plugin for .net SignalR client.
https://pub.dev/packages/signalr_flutter
MIT License
18 stars 28 forks source link

Error: java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT at path $ #47

Open phamhuudat opened 2 years ago

phamhuudat commented 2 years ago

I code app read data from SignalR Asp.Net. But i have a error when recieved data from hub throw plugin signalr_flutter. Status connect hub ok: CONNECT HUB SUCCESS flutter: ConnectionStatus.connecting flutter: ConnectionStatus.connected

When hub push data, in plugin signalr_flutter has a error log 'Error: java.lang.IllegalStateException: Expected STRING but was BEGIN_OBJECT at path $' [ { "RowID": "21", "Info": [ [ "0", "BBB" ], [ "1", "6.6" ], [ "2", "7.06" ] ] } ] content in file pubspec.yaml dependencies: flutter: sdk: flutter

The following adds the Cupertino Icons font to your application.

Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^1.0.2 flutter_svg: ^1.1.5 flutter_bloc: ^8.1.1 get_it: ^7.2.0 dio: ^4.0.6 flutter_secure_storage: ^6.0.0 json_annotation: ^4.7.0 freezed_annotation: ^2.2.0 url_launcher: ^6.1.6 easy_localization: ^3.0.1 signalr_flutter: ^0.2.0

Please check this error for me. thankyou

AyonAB commented 2 years ago

Currently you need to send the data in string format (Serializing the response before sending to the client).

phamhuudat commented 2 years ago

I can only handle this client side problem. Do you have a way to handle it in the signalr plugin code or in my app? thankyou

AyonAB commented 2 years ago

You probably can. You need to fork the repo, change the native code related to receiving data from server for both android & iOS.

nerahmou commented 1 year ago

@phamhuudat resolved?

phamhuudat commented 1 year ago

@phamhuudat resolved? I resolved it You probably can. You need to fork the repo, change the native code related to receiving data from server for both android & iOS.

nerahmou commented 1 year ago

Please, Could you share the code?

Yukari-Tryhard commented 8 months ago

Please, Could you share the code?

It's probably late. But here is the forked repo that can resolve the issue: signalr_flutter

just add this line to your pubspec.yaml and delete all duplicate packages error.

dev_dependencies:
  signalr_flutter:
    git:
      url: https://github.com/usa-12/signalr_flutter

then run flutter clean and flutter pub get.

@AyonAB please fix this. Because in multiple cases we don't just send plain text. And the fixed code is up there. Maybe it could lead to other problems but for now it works fine

AyonAB commented 7 months ago

Please, Could you share the code?

It's probably late. But here is the forked repo that can resolve the issue: signalr_flutter

just add this line to your pubspec.yaml and delete all duplicate packages error.

dev_dependencies:
  signalr_flutter:
    git:
      url: https://github.com/usa-12/signalr_flutter

then run flutter clean and flutter pub get.

@AyonAB please fix this. Because in multiple cases we don't just send plain text. And the fixed code is up there. Maybe it could lead to other problems but for now it works fine

I'm open for any contribution here. Currently I'm too busy to maintain it properly.