signalr_flutter icon indicating copy to clipboard operation
signalr_flutter copied to clipboard

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

Open phamhuudat opened this issue 2 years ago • 8 comments

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

phamhuudat avatar Nov 21 '22 08:11 phamhuudat

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

AyonAB avatar Nov 21 '22 12:11 AyonAB

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

phamhuudat avatar Nov 21 '22 16:11 phamhuudat

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

AyonAB avatar Nov 21 '22 17:11 AyonAB

@phamhuudat resolved?

nerahmou avatar Dec 14 '22 01:12 nerahmou

@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.

phamhuudat avatar Dec 14 '22 06:12 phamhuudat

Please, Could you share the code?

nerahmou avatar Dec 14 '22 11:12 nerahmou

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

Yukari-Tryhard avatar Mar 20 '24 05:03 Yukari-Tryhard

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.

AyonAB avatar Apr 09 '24 16:04 AyonAB