├── .gitignore
├── .idea
├── libraries
│ └── Dart_SDK.xml
├── modules.xml
├── runConfigurations
│ └── example_lib_main_dart.xml
└── workspace.xml
├── .metadata
├── .vscode
└── launch.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── libraries
│ ├── signalr-client-sdk-android.jar
│ └── signalr-client-sdk.jar
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── dev
│ │ └── asdevs
│ │ └── signalr_flutter
│ │ └── SignalrApi.java
│ └── kotlin
│ └── dev
│ └── asdevs
│ └── signalr_flutter
│ └── SignalRFlutterPlugin.kt
├── example
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── dev
│ │ │ │ │ └── asdevs
│ │ │ │ │ └── signalr_flutter_example
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable-v21
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── values-night
│ │ │ │ └── styles.xml
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
├── lib
│ └── main.dart
├── pubspec.lock
├── pubspec.yaml
└── test
│ └── widget_test.dart
├── ios
├── .gitignore
├── Assets
│ ├── .gitkeep
│ ├── SwiftR.js
│ ├── jquery-2.1.3.min.js
│ ├── jquery.signalr-2.4.2.min.js
│ └── jquery.signalr-2.4.3.min.js
├── Classes
│ ├── SignalrApi.h
│ ├── SignalrApi.m
│ ├── SignalrFlutterPlugin.h
│ ├── SignalrFlutterPlugin.m
│ ├── SwiftR.swift
│ ├── SwiftSignalrFlutterPlugin.swift
│ └── signalr_flutter.h
└── signalr_flutter.podspec
├── lib
├── signalr_api.dart
├── signalr_flutter.dart
└── signalr_platform_interface.dart
├── pigeons
└── signalr_api.dart
├── pubspec.lock
├── pubspec.yaml
├── run_pigeon.sh
├── signalr_flutter.iml
└── test
└── signalr_flutter_test.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | build/
8 |
--------------------------------------------------------------------------------
/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations/example_lib_main_dart.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 18116933e77adc82f80866c928266a5b4f1ed645
8 | channel: stable
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "signalr_flutter",
9 | "request": "launch",
10 | "type": "dart"
11 | },
12 | {
13 | "name": "signalr_flutter (profile mode)",
14 | "request": "launch",
15 | "type": "dart",
16 | "flutterMode": "profile"
17 | },
18 | {
19 | "name": "signalr_flutter (release mode)",
20 | "request": "launch",
21 | "type": "dart",
22 | "flutterMode": "release"
23 | },
24 | {
25 | "name": "example",
26 | "cwd": "example",
27 | "request": "launch",
28 | "type": "dart"
29 | },
30 | {
31 | "name": "example (profile mode)",
32 | "cwd": "example",
33 | "request": "launch",
34 | "type": "dart",
35 | "flutterMode": "profile"
36 | },
37 | {
38 | "name": "example (release mode)",
39 | "cwd": "example",
40 | "request": "launch",
41 | "type": "dart",
42 | "flutterMode": "release"
43 | }
44 | ]
45 | }
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.0.1
2 |
3 | * Initial release.
4 |
5 | ## 0.0.2
6 |
7 | * Minor Updates.
8 |
9 | ## 0.0.3
10 |
11 | * Connection Headers and Transport customization added
12 | * Minor changes and a bug fix for invokeServerMethod
13 |
14 | ## 0.0.4
15 |
16 | * Minor Updates.
17 |
18 | ## 0.0.5
19 |
20 | * Fixed a bug where invokeMethod only accepting string as return value
21 |
22 | ## 0.0.6-dev.1
23 |
24 | * Possible fix for callbacks throwing exception about type mismatch.
25 | * invokeMethod now has generic return type & upto 10 arguments support.
26 |
27 | ## 0.0.6-dev.2
28 |
29 | * HubCallBack function now returns the value as well as the subscribed method name.
30 | * invokeMethod now can take as many arguments as you want.
31 |
32 | ## 0.0.6-dev.3
33 |
34 | * Possible fix for ios Hub events not returning
35 |
36 | ## 0.1.0-dev.1
37 |
38 | * Fix for ios Hub events not returning
39 |
40 | ## 0.1.0-dev.2
41 |
42 | * Fixed Duplicated Hub events for ios.
43 |
44 | ## 0.1.0
45 |
46 | * Fix a issue where hub callback only accepting strings.
47 | * Hub callback now returns the message as well as the subscribed method name.
48 | * Made invokeMethod generic.
49 | * As many arguments as you want in invokeMethod.
50 | * fix for ios Hub events not working.
51 |
52 | ## 0.1.1
53 |
54 | * Null Safety Support
55 |
56 | ## 0.1.2
57 |
58 | * IsConnected Method Added
59 |
60 | ## 0.2.0-dev.1
61 |
62 | * Rewrote the plugin using pigeon
63 | * **Breaking Changes**:
64 | * `invokeMethod` now take only strings as arguments instead of dynamic.
65 | * `invokeMethod` now returns only string as result.
66 | * `hubCallback` now also returns string as message instead of dynamic.
67 |
68 | ## 0.2.0-dev.2
69 |
70 | * Fix for invokeMethod calls having no return value.
71 |
72 | ## 0.2.0-dev.3
73 |
74 | * Updated signalr for iOS.
75 | * Transport fallback properly added for iOS.
76 |
77 | ## 0.2.0-dev.4
78 |
79 | * App bundle build issue fix.
80 |
81 | ## 0.2.0-dev.5
82 |
83 | * Removed unnecessary platform exceptions.
84 | * Updated dependencies.
85 |
86 | ## 0.2.0
87 |
88 | * Rewrote the plugin using pigeon.
89 | * Removed unnecessary platform exceptions.
90 | * Updated signalr for iOS.
91 | * Updated all dependencies to the latest.
92 | * **Breaking Changes**:
93 | * `invokeMethod` now take only strings as arguments instead of dynamic.
94 | * `invokeMethod` now returns only string as result.
95 | * `hubCallback` now also returns string as message instead of dynamic.
96 |
97 |
98 | ## unreleased
99 |
100 | - [#64] upgraded GPA (Android Gradle Plugin) to version 8 to comply to deprication of the old flutter gradle implementation.
101 | (link)[https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply]
102 |
103 | - [#64] Plugin now requires the following:
104 | - Flutter >=3.19.0
105 | - Dart >=3.3.0
106 | - compileSDK 33 for Android part
107 | - Java 17 for Android part
108 | - Gradle 8.0 for Android part
109 |
110 |
111 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Ayon Das
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # signalr_flutter
2 |
3 | A flutter plugin for .net SignalR client.
4 |
5 | ## Usage
6 |
7 | First of all, Initialize SignalR and connect to your server.
8 |
9 | ```dart
10 | SignalR signalR = SignalR(
11 | '',
12 | "",
13 | hubMethods: [""]
14 | statusChangeCallback: (status) => print(status),
15 | hubCallback: (methodName, message) => print('MethodName = $methodName, Message = $message'));
16 | signalR.connect();
17 | ```
18 |
19 | Here `statusChangeCallback` will get called whenever connection status with server changes.
20 |
21 | `hubCallback` will receive calls from the server if you subscribe to any hub method. You can do that with `hubMethods`.
22 |
23 | `hubMethods` are the hub method names you want to subscribe.
24 |
25 | There is a `headers` parameters also which takes a `Map`.
26 |
27 | You can also invoke any server method.
28 |
29 | ```dart
30 | signalR.invokeMethod("", arguments: ["argument1", "argument2"]);
31 | ```
32 |
33 |
34 | 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.
35 |
36 | ```xml
37 |
39 |
40 | ```
41 |
42 | This is because of the [Network Security Config](https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted).
43 |
44 | 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.
45 |
46 | `-keep class microsoft.aspnet.signalr.client.hubs.** { *; }`
47 |
48 |
49 | For more info check example.
50 |
51 | Any issue or PR is always welcome.
52 |
53 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
5 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.library"
3 | id "kotlin-android"
4 | }
5 |
6 | group 'dev.asdevs.signalr_flutter'
7 | version '1.0-SNAPSHOT'
8 |
9 | rootProject.allprojects {
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | }
15 |
16 | android {
17 | namespace 'dev.asdevs.signalr_flutter'
18 | compileOptions {
19 | sourceCompatibility JavaVersion.VERSION_17
20 | targetCompatibility JavaVersion.VERSION_17
21 | }
22 |
23 | kotlinOptions {
24 | jvmTarget = '17'
25 | }
26 |
27 | sourceSets {
28 | main.java.srcDirs += 'src/main/kotlin'
29 | }
30 |
31 | defaultConfig {
32 | compileSdk 33
33 | minSdkVersion 21
34 | }
35 | }
36 |
37 | dependencies {
38 | implementation 'com.google.code.gson:gson:2.8.9'
39 | implementation files('libraries/signalr-client-sdk.jar')
40 | implementation files('libraries/signalr-client-sdk-android.jar')
41 | }
42 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
6 |
--------------------------------------------------------------------------------
/android/libraries/signalr-client-sdk-android.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AS-Devs/signalr_flutter/8bd721a9c572120d3a71bc12edf7baaec88bfb5b/android/libraries/signalr-client-sdk-android.jar
--------------------------------------------------------------------------------
/android/libraries/signalr-client-sdk.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AS-Devs/signalr_flutter/8bd721a9c572120d3a71bc12edf7baaec88bfb5b/android/libraries/signalr-client-sdk.jar
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 |
3 | repositories {
4 | google()
5 | mavenCentral()
6 | gradlePluginPortal()
7 | }
8 | }
9 |
10 | plugins {
11 | id "com.android.library" version "8.1.0" apply false
12 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false
13 | }
14 |
15 | rootProject.name = 'signalr_flutter'
16 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/android/src/main/java/dev/asdevs/signalr_flutter/SignalrApi.java:
--------------------------------------------------------------------------------
1 | // Autogenerated from Pigeon (v4.2.5), do not edit directly.
2 | // See also: https://pub.dev/packages/pigeon
3 |
4 | package dev.asdevs.signalr_flutter;
5 |
6 | import android.util.Log;
7 | import androidx.annotation.NonNull;
8 | import androidx.annotation.Nullable;
9 | import io.flutter.plugin.common.BasicMessageChannel;
10 | import io.flutter.plugin.common.BinaryMessenger;
11 | import io.flutter.plugin.common.MessageCodec;
12 | import io.flutter.plugin.common.StandardMessageCodec;
13 | import java.io.ByteArrayOutputStream;
14 | import java.nio.ByteBuffer;
15 | import java.util.Arrays;
16 | import java.util.ArrayList;
17 | import java.util.Collections;
18 | import java.util.List;
19 | import java.util.Map;
20 | import java.util.HashMap;
21 |
22 | /**Generated class from Pigeon. */
23 | @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
24 | public class SignalrApi {
25 |
26 | /** Transport method of the signalr connection. */
27 | public enum Transport {
28 | AUTO(0),
29 | SERVER_SENT_EVENTS(1),
30 | LONG_POLLING(2);
31 |
32 | private int index;
33 | private Transport(final int index) {
34 | this.index = index;
35 | }
36 | }
37 |
38 | /** SignalR connection status */
39 | public enum ConnectionStatus {
40 | CONNECTING(0),
41 | CONNECTED(1),
42 | RECONNECTING(2),
43 | DISCONNECTED(3),
44 | CONNECTION_SLOW(4),
45 | CONNECTION_ERROR(5);
46 |
47 | private int index;
48 | private ConnectionStatus(final int index) {
49 | this.index = index;
50 | }
51 | }
52 |
53 | /** Generated class from Pigeon that represents data sent in messages. */
54 | public static class ConnectionOptions {
55 | private @Nullable String baseUrl;
56 | public @Nullable String getBaseUrl() { return baseUrl; }
57 | public void setBaseUrl(@Nullable String setterArg) {
58 | this.baseUrl = setterArg;
59 | }
60 |
61 | private @Nullable String hubName;
62 | public @Nullable String getHubName() { return hubName; }
63 | public void setHubName(@Nullable String setterArg) {
64 | this.hubName = setterArg;
65 | }
66 |
67 | private @Nullable String queryString;
68 | public @Nullable String getQueryString() { return queryString; }
69 | public void setQueryString(@Nullable String setterArg) {
70 | this.queryString = setterArg;
71 | }
72 |
73 | private @Nullable List hubMethods;
74 | public @Nullable List getHubMethods() { return hubMethods; }
75 | public void setHubMethods(@Nullable List setterArg) {
76 | this.hubMethods = setterArg;
77 | }
78 |
79 | private @Nullable Map headers;
80 | public @Nullable Map getHeaders() { return headers; }
81 | public void setHeaders(@Nullable Map setterArg) {
82 | this.headers = setterArg;
83 | }
84 |
85 | private @Nullable Transport transport;
86 | public @Nullable Transport getTransport() { return transport; }
87 | public void setTransport(@Nullable Transport setterArg) {
88 | this.transport = setterArg;
89 | }
90 |
91 | public static final class Builder {
92 | private @Nullable String baseUrl;
93 | public @NonNull Builder setBaseUrl(@Nullable String setterArg) {
94 | this.baseUrl = setterArg;
95 | return this;
96 | }
97 | private @Nullable String hubName;
98 | public @NonNull Builder setHubName(@Nullable String setterArg) {
99 | this.hubName = setterArg;
100 | return this;
101 | }
102 | private @Nullable String queryString;
103 | public @NonNull Builder setQueryString(@Nullable String setterArg) {
104 | this.queryString = setterArg;
105 | return this;
106 | }
107 | private @Nullable List hubMethods;
108 | public @NonNull Builder setHubMethods(@Nullable List setterArg) {
109 | this.hubMethods = setterArg;
110 | return this;
111 | }
112 | private @Nullable Map headers;
113 | public @NonNull Builder setHeaders(@Nullable Map setterArg) {
114 | this.headers = setterArg;
115 | return this;
116 | }
117 | private @Nullable Transport transport;
118 | public @NonNull Builder setTransport(@Nullable Transport setterArg) {
119 | this.transport = setterArg;
120 | return this;
121 | }
122 | public @NonNull ConnectionOptions build() {
123 | ConnectionOptions pigeonReturn = new ConnectionOptions();
124 | pigeonReturn.setBaseUrl(baseUrl);
125 | pigeonReturn.setHubName(hubName);
126 | pigeonReturn.setQueryString(queryString);
127 | pigeonReturn.setHubMethods(hubMethods);
128 | pigeonReturn.setHeaders(headers);
129 | pigeonReturn.setTransport(transport);
130 | return pigeonReturn;
131 | }
132 | }
133 | @NonNull Map toMap() {
134 | Map toMapResult = new HashMap<>();
135 | toMapResult.put("baseUrl", baseUrl);
136 | toMapResult.put("hubName", hubName);
137 | toMapResult.put("queryString", queryString);
138 | toMapResult.put("hubMethods", hubMethods);
139 | toMapResult.put("headers", headers);
140 | toMapResult.put("transport", transport == null ? null : transport.index);
141 | return toMapResult;
142 | }
143 | static @NonNull ConnectionOptions fromMap(@NonNull Map map) {
144 | ConnectionOptions pigeonResult = new ConnectionOptions();
145 | Object baseUrl = map.get("baseUrl");
146 | pigeonResult.setBaseUrl((String)baseUrl);
147 | Object hubName = map.get("hubName");
148 | pigeonResult.setHubName((String)hubName);
149 | Object queryString = map.get("queryString");
150 | pigeonResult.setQueryString((String)queryString);
151 | Object hubMethods = map.get("hubMethods");
152 | pigeonResult.setHubMethods((List)hubMethods);
153 | Object headers = map.get("headers");
154 | pigeonResult.setHeaders((Map)headers);
155 | Object transport = map.get("transport");
156 | pigeonResult.setTransport(transport == null ? null : Transport.values()[(int)transport]);
157 | return pigeonResult;
158 | }
159 | }
160 |
161 | /** Generated class from Pigeon that represents data sent in messages. */
162 | public static class StatusChangeResult {
163 | private @Nullable String connectionId;
164 | public @Nullable String getConnectionId() { return connectionId; }
165 | public void setConnectionId(@Nullable String setterArg) {
166 | this.connectionId = setterArg;
167 | }
168 |
169 | private @Nullable ConnectionStatus status;
170 | public @Nullable ConnectionStatus getStatus() { return status; }
171 | public void setStatus(@Nullable ConnectionStatus setterArg) {
172 | this.status = setterArg;
173 | }
174 |
175 | private @Nullable String errorMessage;
176 | public @Nullable String getErrorMessage() { return errorMessage; }
177 | public void setErrorMessage(@Nullable String setterArg) {
178 | this.errorMessage = setterArg;
179 | }
180 |
181 | public static final class Builder {
182 | private @Nullable String connectionId;
183 | public @NonNull Builder setConnectionId(@Nullable String setterArg) {
184 | this.connectionId = setterArg;
185 | return this;
186 | }
187 | private @Nullable ConnectionStatus status;
188 | public @NonNull Builder setStatus(@Nullable ConnectionStatus setterArg) {
189 | this.status = setterArg;
190 | return this;
191 | }
192 | private @Nullable String errorMessage;
193 | public @NonNull Builder setErrorMessage(@Nullable String setterArg) {
194 | this.errorMessage = setterArg;
195 | return this;
196 | }
197 | public @NonNull StatusChangeResult build() {
198 | StatusChangeResult pigeonReturn = new StatusChangeResult();
199 | pigeonReturn.setConnectionId(connectionId);
200 | pigeonReturn.setStatus(status);
201 | pigeonReturn.setErrorMessage(errorMessage);
202 | return pigeonReturn;
203 | }
204 | }
205 | @NonNull Map toMap() {
206 | Map toMapResult = new HashMap<>();
207 | toMapResult.put("connectionId", connectionId);
208 | toMapResult.put("status", status == null ? null : status.index);
209 | toMapResult.put("errorMessage", errorMessage);
210 | return toMapResult;
211 | }
212 | static @NonNull StatusChangeResult fromMap(@NonNull Map map) {
213 | StatusChangeResult pigeonResult = new StatusChangeResult();
214 | Object connectionId = map.get("connectionId");
215 | pigeonResult.setConnectionId((String)connectionId);
216 | Object status = map.get("status");
217 | pigeonResult.setStatus(status == null ? null : ConnectionStatus.values()[(int)status]);
218 | Object errorMessage = map.get("errorMessage");
219 | pigeonResult.setErrorMessage((String)errorMessage);
220 | return pigeonResult;
221 | }
222 | }
223 |
224 | public interface Result {
225 | void success(T result);
226 | void error(Throwable error);
227 | }
228 | private static class SignalRHostApiCodec extends StandardMessageCodec {
229 | public static final SignalRHostApiCodec INSTANCE = new SignalRHostApiCodec();
230 | private SignalRHostApiCodec() {}
231 | @Override
232 | protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) {
233 | switch (type) {
234 | case (byte)128:
235 | return ConnectionOptions.fromMap((Map) readValue(buffer));
236 |
237 | default:
238 | return super.readValueOfType(type, buffer);
239 |
240 | }
241 | }
242 | @Override
243 | protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) {
244 | if (value instanceof ConnectionOptions) {
245 | stream.write(128);
246 | writeValue(stream, ((ConnectionOptions) value).toMap());
247 | } else
248 | {
249 | super.writeValue(stream, value);
250 | }
251 | }
252 | }
253 |
254 | /** Generated interface from Pigeon that represents a handler of messages from Flutter. */
255 | public interface SignalRHostApi {
256 | void connect(@NonNull ConnectionOptions connectionOptions, Result result);
257 | void reconnect(Result result);
258 | void stop(Result result);
259 | void isConnected(Result result);
260 | void invokeMethod(@NonNull String methodName, @NonNull List arguments, Result result);
261 |
262 | /** The codec used by SignalRHostApi. */
263 | static MessageCodec