├── ios ├── Assets │ ├── .gitkeep │ └── SwiftR.js ├── Classes │ ├── SignalrFlutterPlugin.h │ ├── signalr_flutter.h │ ├── SignalrFlutterPlugin.m │ ├── SignalrApi.h │ ├── SwiftSignalrFlutterPlugin.swift │ ├── SignalrApi.m │ └── SwiftR.swift ├── .gitignore └── signalr_flutter.podspec ├── .gitignore ├── example ├── ios │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── 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-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── Podfile.lock │ ├── .gitignore │ └── Podfile ├── android │ ├── gradle.properties │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── 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 │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values-night │ │ │ │ │ │ └── styles.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── dev │ │ │ │ │ │ └── asdevs │ │ │ │ │ │ └── signalr_flutter_example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── build.gradle │ └── settings.gradle ├── .metadata ├── README.md ├── .gitignore ├── test │ └── widget_test.dart ├── analysis_options.yaml ├── pubspec.yaml ├── lib │ └── main.dart └── pubspec.lock ├── android ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ └── dev │ │ │ └── asdevs │ │ │ └── signalr_flutter │ │ │ └── SignalRFlutterPlugin.kt │ │ └── java │ │ └── dev │ │ └── asdevs │ │ └── signalr_flutter │ │ └── SignalrApi.java ├── gradle.properties ├── libraries │ ├── signalr-client-sdk.jar │ └── signalr-client-sdk-android.jar ├── .gitignore ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── analysis_options.yaml ├── .idea ├── runConfigurations │ └── example_lib_main_dart.xml ├── modules.xml ├── libraries │ └── Dart_SDK.xml └── workspace.xml ├── .metadata ├── run_pigeon.sh ├── test └── signalr_flutter_test.dart ├── signalr_flutter.iml ├── LICENSE ├── pubspec.yaml ├── .vscode └── launch.json ├── pigeons └── signalr_api.dart ├── README.md ├── lib ├── signalr_platform_interface.dart ├── signalr_flutter.dart └── signalr_api.dart ├── CHANGELOG.md └── pubspec.lock /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/libraries/signalr-client-sdk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/android/libraries/signalr-client-sdk.jar -------------------------------------------------------------------------------- /ios/Classes/SignalrFlutterPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface SignalrFlutterPlugin : NSObject 4 | @end 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 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /android/libraries/signalr-client-sdk-android.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/android/libraries/signalr-client-sdk-android.jar -------------------------------------------------------------------------------- /ios/Classes/signalr_flutter.h: -------------------------------------------------------------------------------- 1 | // 2 | // signalr_flutter.h 3 | // signalr_flutter 4 | // 5 | // Created by Ayon Das on 07/11/21. 6 | // 7 | 8 | #import "SignalrApi.h" 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AS-Devs/signalr_flutter/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/dev/asdevs/signalr_flutter_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package dev.asdevs.signalr_flutter_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations/example_lib_main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /example/.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: app 11 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = '../build' 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | project.evaluationDependsOn(':app') 12 | } 13 | 14 | tasks.register("clean", Delete) { 15 | delete rootProject.buildDir 16 | } 17 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /run_pigeon.sh: -------------------------------------------------------------------------------- 1 | # Run this file to regenerate pigeon files 2 | flutter pub run pigeon \ 3 | --input pigeons/signalr_api.dart \ 4 | --dart_out lib/signalr_api.dart \ 5 | --objc_header_out ios/Classes/SignalrApi.h \ 6 | --objc_source_out ios/Classes/SignalrApi.m \ 7 | --objc_prefix FLT \ 8 | --java_out android/src/main/java/dev/asdevs/signalr_flutter/SignalrApi.java \ 9 | --java_package "dev.asdevs.signalr_flutter" -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/ephemeral/ 38 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - signalr_flutter (0.0.1): 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - signalr_flutter (from `.symlinks/plugins/signalr_flutter/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | signalr_flutter: 14 | :path: ".symlinks/plugins/signalr_flutter/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 18 | signalr_flutter: fcbc21129947f1f53e38b6b035012aa150359bc8 19 | 20 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 21 | 22 | COCOAPODS: 1.11.3 23 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # signalr_flutter_example 2 | 3 | Demonstrates how to use the signalr_flutter plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /ios/Classes/SignalrFlutterPlugin.m: -------------------------------------------------------------------------------- 1 | #import "SignalrFlutterPlugin.h" 2 | #if __has_include() 3 | #import 4 | #else 5 | // Support project import fallback if the generated compatibility header 6 | // is not copied when this plugin is created as a library. 7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 8 | #import "signalr_flutter-Swift.h" 9 | #endif 10 | 11 | @implementation SignalrFlutterPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftSignalrFlutterPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /test/signalr_flutter_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | const MethodChannel channel = MethodChannel('signalr_flutter'); 6 | 7 | setUpAll(() { 8 | TestWidgetsFlutterBinding.ensureInitialized(); 9 | }); 10 | 11 | setUp(() { 12 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger 13 | .setMockMethodCallHandler(channel, (MethodCall methodCall) async { 14 | return '42'; 15 | }); 16 | }); 17 | 18 | tearDown(() { 19 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger 20 | .setMockMethodCallHandler(channel, null); 21 | }); 22 | 23 | test('getPlatformVersion', () async {}); 24 | } 25 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.1.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false 23 | } 24 | 25 | include ':app' -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /.idea/libraries/Dart_SDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /signalr_flutter.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:signalr_flutter_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => 22 | widget is Text && widget.data!.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /ios/signalr_flutter.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint signalr_flutter.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'signalr_flutter' 7 | s.version = '0.0.1' 8 | s.summary = 'A new flutter plugin project.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'https://github.com/AS-Devs/signalr_flutter' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Ayon Das' => 'ayantorres@gmail.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.resources = 'Assets/**/*.js' 18 | s.dependency 'Flutter' 19 | s.platform = :ios, '8.0' 20 | 21 | # Flutter.framework does not contain a i386 slice. 22 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } 23 | s.swift_version = '5.0' 24 | end 25 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: signalr_flutter 2 | description: A flutter plugin for .net SignalR client. This client is for ASP.Net SignalR, not for .Net Core SignalR. 3 | version: 0.2.1 4 | repository: https://github.com/AS-Devs/signalr_flutter 5 | issue_tracker: https://github.com/AS-Devs/signalr_flutter/issues 6 | 7 | environment: 8 | flutter: ">=3.19.0" 9 | sdk: ">=3.2.0 <4.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | flutter_lints: ^6.0.0 19 | pigeon: ^4.2.5 20 | 21 | # For information on the generic Dart part of this file, see the 22 | # following page: https://dart.dev/tools/pub/pubspec 23 | 24 | # The following section is specific to Flutter. 25 | flutter: 26 | # This section identifies this Flutter project as a plugin project. 27 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily 28 | # be modified. They are used by the tooling to maintain consistency when 29 | # adding or updating assets for this project. 30 | plugin: 31 | platforms: 32 | android: 33 | package: dev.asdevs.signalr_flutter 34 | pluginClass: SignalrFlutterPlugin 35 | ios: 36 | pluginClass: SignalrFlutterPlugin -------------------------------------------------------------------------------- /.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 | } -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /pigeons/signalr_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:pigeon/pigeon.dart'; 2 | 3 | /// Transport method of the signalr connection. 4 | enum Transport { auto, serverSentEvents, longPolling } 5 | 6 | /// SignalR connection status 7 | enum ConnectionStatus { 8 | connecting, 9 | connected, 10 | reconnecting, 11 | disconnected, 12 | connectionSlow, 13 | connectionError 14 | } 15 | 16 | class ConnectionOptions { 17 | String? baseUrl; 18 | String? hubName; 19 | String? queryString; 20 | List? hubMethods; 21 | Map? headers; 22 | Transport? transport; 23 | } 24 | 25 | class StatusChangeResult { 26 | String? connectionId; 27 | ConnectionStatus? status; 28 | String? errorMessage; 29 | } 30 | 31 | @HostApi() 32 | abstract class SignalRHostApi { 33 | @async 34 | String connect(ConnectionOptions connectionOptions); 35 | 36 | @async 37 | String reconnect(); 38 | 39 | @async 40 | void stop(); 41 | 42 | @async 43 | bool isConnected(); 44 | 45 | @async 46 | String invokeMethod(String methodName, List arguments); 47 | } 48 | 49 | @FlutterApi() 50 | abstract class SignalRPlatformApi { 51 | @async 52 | void onStatusChange(StatusChangeResult statusChangeResult); 53 | 54 | @async 55 | void onNewMessage(String hubName, String message); 56 | } 57 | 58 | void configurePigeon(PigeonOptions opts) { 59 | opts = const PigeonOptions( 60 | input: 'pigeons/signalr_api.dart', 61 | dartOut: '../lib/signalr_api.dart', 62 | objcHeaderOut: 'ios/Classes/signalr_api.h', 63 | objcSourceOut: 'ios/Classes/signalr_api.m', 64 | javaOut: 'android/src/main/java/dev/asdevs/signalr_flutter/Signalr_Api.java', 65 | ); 66 | } 67 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | 8 | def localProperties = new Properties() 9 | def localPropertiesFile = rootProject.file('local.properties') 10 | if (localPropertiesFile.exists()) { 11 | localPropertiesFile.withReader('UTF-8') { reader -> 12 | localProperties.load(reader) 13 | } 14 | } 15 | 16 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 17 | if (flutterVersionCode == null) { 18 | flutterVersionCode = '1' 19 | } 20 | 21 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 22 | if (flutterVersionName == null) { 23 | flutterVersionName = '1.0' 24 | } 25 | 26 | android { 27 | namespace "dev.asdevs.signalr_flutter_example" 28 | 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_17 31 | targetCompatibility JavaVersion.VERSION_17 32 | } 33 | 34 | kotlinOptions { 35 | jvmTarget = '17' 36 | } 37 | 38 | sourceSets { 39 | main.java.srcDirs += 'src/main/kotlin' 40 | } 41 | 42 | defaultConfig { 43 | applicationId "dev.asdevs.signalr_flutter_example" 44 | compileSdk 33 45 | minSdkVersion 21 46 | targetSdkVersion 33 47 | versionCode flutterVersionCode.toInteger() 48 | versionName flutterVersionName 49 | } 50 | 51 | buildTypes { 52 | release { 53 | // Signing with the debug keys for now, so `flutter run --release` works. 54 | signingConfig signingConfigs.debug 55 | } 56 | } 57 | } 58 | 59 | flutter { 60 | source '../..' 61 | } 62 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | signalr_flutter_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /lib/signalr_platform_interface.dart: -------------------------------------------------------------------------------- 1 | import 'package:signalr_flutter/signalr_api.dart'; 2 | 3 | abstract class SignalrPlatformInterface { 4 | SignalrPlatformInterface(this.baseUrl, this.hubName, 5 | {this.queryString, 6 | this.headers, 7 | this.hubMethods, 8 | this.transport = Transport.auto, 9 | this.statusChangeCallback, 10 | this.hubCallback}) 11 | : assert(baseUrl != ''), 12 | assert(hubName != ''); 13 | 14 | final String baseUrl; 15 | final String hubName; 16 | final String? queryString; 17 | 18 | /// [Transport.Auto] is default. 19 | final Transport transport; 20 | final Map? headers; 21 | 22 | String? connectionId; 23 | 24 | /// List of Hub method names you want to subscribe. Every subsequent message from server gets called on [hubCallback]. 25 | final List? hubMethods; 26 | 27 | /// This callback gets called whenever SignalR connection status with server changes. 28 | final void Function(ConnectionStatus?)? statusChangeCallback; 29 | 30 | /// This callback gets called whenever SignalR server sends some message to client. 31 | final void Function(String, String)? hubCallback; 32 | 33 | /// Connect to the SignalR Server with given [baseUrl] & [hubName]. 34 | /// 35 | /// [queryString] is a optional field to send query to server. 36 | /// 37 | /// Returns the [connectionId]. 38 | Future connect(); 39 | 40 | /// Try to Reconnect SignalR connection if it gets disconnected. 41 | /// 42 | /// Returns the [connectionId] 43 | Future reconnect(); 44 | 45 | /// Stops SignalR connection 46 | Future stop(); 47 | 48 | /// Checks if SignalR connection is still active. 49 | /// 50 | /// Returns a boolean value 51 | Future isConnected(); 52 | 53 | /// Invoke any server method with optional [arguments]. 54 | Future invokeMethod(String methodName, {List? arguments}); 55 | } 56 | -------------------------------------------------------------------------------- /.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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: signalr_flutter_example 2 | description: Demonstrates how to use the signalr_flutter plugin. 3 | version: 1.1.0+1 4 | 5 | # The following line prevents the package from being accidentally published to 6 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 7 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 8 | 9 | environment: 10 | flutter: ">=3.19.0" 11 | sdk: ">=3.2.0" 12 | 13 | # Dependencies specify other packages that your package needs in order to work. 14 | # To automatically upgrade your package dependencies to the latest versions 15 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 16 | # dependencies can be manually updated by changing the version numbers below to 17 | # the latest version available on pub.dev. To see which dependencies have newer 18 | # versions available, run `flutter pub outdated`. 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | signalr_flutter: 24 | # When depending on this package from a real application you should use: 25 | # signalr_flutter: ^x.y.z 26 | # See https://dart.dev/tools/pub/dependencies#version-constraints 27 | # The example app is bundled with the plugin so we use a path dependency on 28 | # the parent directory to use the current plugin's version. 29 | path: ../ 30 | 31 | # The following adds the Cupertino Icons font to your application. 32 | # Use with the CupertinoIcons class for iOS style icons. 33 | cupertino_icons: ^1.0.5 34 | 35 | dev_dependencies: 36 | flutter_test: 37 | sdk: flutter 38 | 39 | # The "flutter_lints" package below contains a set of recommended lints to 40 | # encourage good coding practices. The lint set provided by the package is 41 | # activated in the `analysis_options.yaml` file located at the root of your 42 | # package. See that file for information about deactivating specific lint 43 | # rules and activating additional ones. 44 | flutter_lints: ^2.0.1 45 | 46 | # For information on the generic Dart part of this file, see the 47 | # following page: https://dart.dev/tools/pub/pubspec 48 | 49 | # The following section is specific to Flutter. 50 | flutter: 51 | 52 | uses-material-design: true -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 13 | 17 | 21 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /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 | ## 0.2.1 98 | 99 | * [#64] upgraded GPA (Android Gradle Plugin) to version 8 to comply to deprication of the old flutter gradle implementation. 100 | 101 | * [#64] Plugin now requires the following: 102 | - Flutter >=3.19.0 103 | - Dart >=3.3.0 104 | - compileSDK 33 for Android part 105 | - Java 17 for Android part 106 | - Gradle 8.0 for Android part 107 | 108 | * Connection error feedback with `connectionErrorCallback` 109 | 110 | 111 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: avoid_print 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'dart:async'; 5 | 6 | import 'package:signalr_flutter/signalr_api.dart'; 7 | import 'package:signalr_flutter/signalr_flutter.dart'; 8 | 9 | void main() { 10 | runApp(const MyApp()); 11 | } 12 | 13 | class MyApp extends StatefulWidget { 14 | const MyApp({Key? key}) : super(key: key); 15 | 16 | @override 17 | State createState() => _MyAppState(); 18 | } 19 | 20 | class _MyAppState extends State { 21 | String signalRStatus = "disconnected"; 22 | late SignalR signalR; 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | initPlatformState(); 28 | } 29 | 30 | // Platform messages are asynchronous, so we initialize in an async method. 31 | Future initPlatformState() async { 32 | signalR = SignalR( 33 | "", 34 | "", 35 | hubMethods: [""], 36 | statusChangeCallback: _onStatusChange, 37 | hubCallback: _onNewMessage, 38 | ); 39 | } 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | return MaterialApp( 44 | home: Scaffold( 45 | appBar: AppBar( 46 | title: const Text("SignalR Plugin Example App"), 47 | ), 48 | body: Column( 49 | crossAxisAlignment: CrossAxisAlignment.stretch, 50 | mainAxisAlignment: MainAxisAlignment.center, 51 | children: [ 52 | Text( 53 | "Connection Status: $signalRStatus\n", 54 | style: Theme.of(context).textTheme.titleLarge, 55 | textAlign: TextAlign.center, 56 | ), 57 | Padding( 58 | padding: const EdgeInsets.only(top: 20.0), 59 | child: ElevatedButton( 60 | onPressed: _buttonTapped, 61 | child: const Text("Invoke Method"), 62 | ), 63 | ) 64 | ], 65 | ), 66 | floatingActionButton: FloatingActionButton( 67 | child: const Icon(Icons.cast_connected), 68 | onPressed: () async { 69 | final isConnected = await signalR.isConnected(); 70 | if (!isConnected) { 71 | final connId = await signalR.connect(); 72 | print("Connection ID: $connId"); 73 | } else { 74 | signalR.stop(); 75 | } 76 | }, 77 | ), 78 | ), 79 | ); 80 | } 81 | 82 | void _onStatusChange(ConnectionStatus? status) { 83 | if (mounted) { 84 | setState(() { 85 | signalRStatus = status?.name ?? ConnectionStatus.disconnected.name; 86 | }); 87 | } 88 | } 89 | 90 | void _onNewMessage(String methodName, String message) { 91 | print("MethodName = $methodName, Message = $message"); 92 | } 93 | 94 | void _buttonTapped() async { 95 | try { 96 | final result = await signalR.invokeMethod( 97 | "", 98 | arguments: [""], 99 | ); 100 | print(result); 101 | } catch (e) { 102 | print(e); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /ios/Assets/SwiftR.js: -------------------------------------------------------------------------------- 1 | window.swiftR = { 2 | connection: null, 3 | hubs: {}, 4 | transport: ['webSockets','serverSentEvents','longPolling'], 5 | headers: {}, 6 | messages: {} 7 | }; 8 | 9 | $(function () { 10 | $.ajaxSetup({ 11 | beforeSend: function (jqxhr) { 12 | for (var h in swiftR.headers) { 13 | jqxhr.setRequestHeader(h, swiftR.headers[h]); 14 | } 15 | } 16 | }); 17 | postMessage({ message: 'ready' }); 18 | }); 19 | 20 | function initialize(baseUrl, isHub) { 21 | swiftR.connection = isHub ? $.hubConnection(baseUrl) : $.connection(baseUrl); 22 | var connection = swiftR.connection; 23 | 24 | connection.logging = true; 25 | 26 | if (!isHub) { 27 | connection.received(function (data) { 28 | postMessage({ data: data }); 29 | }); 30 | } 31 | 32 | connection.starting(function () { 33 | postMessage({ message: 'starting' }); 34 | }); 35 | 36 | connection.connectionSlow(function () { 37 | postMessage({ message: 'connectionSlow' }); 38 | }); 39 | 40 | connection.reconnecting(function () { 41 | postMessage({ message: 'reconnecting' }); 42 | }); 43 | 44 | connection.reconnected(function () { 45 | postMessage({ message: 'reconnected' }); 46 | }); 47 | 48 | connection.disconnected(function () { 49 | postMessage({ message: 'disconnected' }); 50 | }); 51 | 52 | connection.error(function (error) { 53 | postMessage({ message: 'error', error: processError(error) }); 54 | }); 55 | } 56 | 57 | function start() { 58 | swiftR.connection.start({ transport: swiftR.transport }).done(function () { 59 | postMessage({ message: 'connected', connectionId: swiftR.connection.id }); 60 | }).fail(function () { 61 | postMessage({ message: 'connectionFailed' }); 62 | }); 63 | } 64 | 65 | function addHandler(id, hubName, method) { 66 | var hub = ensureHub(hubName); 67 | 68 | hub.on(method, function () { 69 | postMessage({ 70 | id: id, 71 | hub: hub.hubName, 72 | method: method, 73 | arguments: [].slice.call(arguments) 74 | }); 75 | }); 76 | } 77 | 78 | function postMessage(msg) { 79 | var id = Math.random().toString(36).slice(2, 10); 80 | swiftR.messages[id] = msg; 81 | 82 | if (window.webkit) { 83 | webkit.messageHandlers.interOp.postMessage(id); 84 | } else { 85 | var frame = $('