Search packages, repositories and app categories

Package detailsv0.2.1

signalr_flutter

A flutter plugin for .net SignalR client. This client is for ASP.Net SignalR, not for .Net Core SignalR.

AndroidiOS
30-day downloads
185
Likes
83
Pub points
150

Install package

flutter pub add signalr_flutter

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

signalr_flutter is a Flutter plugin that enables real-time communication with ASP.NET SignalR servers. It facilitates bidirectional messaging between Flutter apps and .NET-based SignalR backends, supporting features like connection management, event handling, and automatic reconnection. Designed specifically for ASP.NET SignalR (not .NET Core), it integrates seamlessly into Android and iOS applications. The plugin simplifies implementing live updates, chat systems, notifications, and collaborative tools in Flutter apps.

Use cases

  • Real-time chat applications
  • Live dashboard updates
  • Push notifications
  • Collaborative editing tools
  • IoT device monitoring

Key features

  • Supports ASP.NET SignalR only
  • Bidirectional communication
  • Automatic reconnection
  • Event-driven message handling
  • Lightweight and platform-agnostic

Suitable for

  • Developers using ASP.NET SignalR
  • Apps requiring real-time data sync
  • Mobile apps needing live updates
  • Teams building interactive experiences

Considerations

  • Not compatible with .NET Core SignalR
  • Requires server-side ASP.NET SignalR setup
  • Limited to Android and iOS platforms

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

signalr_flutter

A flutter plugin for .net SignalR client.

Usage

First of all, Initialize SignalR and connect to your server.

SignalR signalR = SignalR(
        '<Your server url here>',
        "<Your hub name here>",
        hubMethods: ["<Your Hub Method Names>"]
        statusChangeCallback: (status) => print(status),
        hubCallback: (methodName, message) => print('MethodName = $methodName, Message = $message'));
signalR.connect();

Here statusChangeCallback will get called whenever connection status with server changes.

hubCallback will receive calls from the server if you subscribe to any hub method. You can do that with hubMethods.

hubMethods are the hub method names you want to subscribe.

There is a headers parameters also which takes a Map<String, String>.

You can also invoke any server method.

signalR.invokeMethod("<Your method name here>", arguments: ["argument1", "argument2"]);

If you are trying to connect with a HTTP url, then you need to add the following lines to the manifest of your android project.

<application
        android:usesCleartextTraffic="true">
</application>

This is because of the Network Security Config.

R8 may strip away some SignalR classes for the Android in Release Builds. Add the following line in your proguard-rules.pro file to solve this issue.

-keep class microsoft.aspnet.signalr.client.hubs.** { *; }

For more info check example.

Any issue or PR is always welcome.

Categories

Source repository

Projects using this package

No data available yet.