signalr_flutter_name_safe 0.2.1+1
signalr_flutter_name_safe: ^0.2.1+1 copied to clipboard
A flutter plugin for .net SignalR client. This client is for ASP.Net SignalR, not for .Net Core SignalR. Fork fixing Android build file naming issue.
signalr_flutter_name_safe #
Note: This is an unofficial fork of
signalr_flutterthat fixes a critical Android build issue.
Why This Fork? #
The original signalr_flutter package had a file naming bug where the Kotlin file was named SignalRFlutterPlugin.kt (capital R) but the class inside was SignalrFlutterPlugin (lowercase r). This caused build failures on case-sensitive file systems (Linux, macOS with APFS case-sensitive).
This fork fixes that issue by renaming the file to match the class name: SignalrFlutterPlugin.kt.
About #
A flutter plugin for .net SignalR client.
Usage #
First of all, Initialize SignalR and connect to your server.
SignalR signalR = SignalR(
'<Your server url here>',
"<Your hub name here>",
hubMethods: ["<Your Hub Method Names>"]
statusChangeCallback: (status) => print(status),
hubCallback: (methodName, message) => print('MethodName = $methodName, Message = $message'));
signalR.connect();
Here statusChangeCallback will get called whenever connection status with server changes.
hubCallback will receive calls from the server if you subscribe to any hub method. You can do that with hubMethods.
hubMethods are the hub method names you want to subscribe.
There is a headers parameters also which takes a Map<String, String>.
You can also invoke any server method.
signalR.invokeMethod("<Your method name here>", arguments: ["argument1", "argument2"]);
If you are trying to connect with a HTTP url, then you need to add the following lines to the manifest of your android project.
<application
android:usesCleartextTraffic="true">
</application>
This is because of the Network Security Config.
R8 may strip away some SignalR classes for the Android in Release Builds. Add the following line in your proguard-rules.pro file to solve this issue.
-keep class microsoft.aspnet.signalr.client.hubs.** { *; }
For more info check example.
Any issue or PR is always welcome.