rasel_chatting_sdk 0.2.3 copy "rasel_chatting_sdk: ^0.2.3" to clipboard
rasel_chatting_sdk: ^0.2.3 copied to clipboard

Flutter client for the Rasel Chatting SDK — REST API, WebSocket chat, groups, media, reactions, search, push registration, and a drop-in WhatsApp-style chat UI.

rasel_chatting_sdk #

Flutter client for the Rasel Chatting SDK — a multi-tenant chat-as-a-service platform. Ship a complete WhatsApp-style chat UI with one widget, or use the REST API and WebSocket client directly for custom integrations.

Features #

  • Drop-in UIRaselChatApp with login, chat list, conversations, media, voice, reactions, settings
  • REST client: auth, groups, messages, file upload, profile, reactions, search
  • Real-time chat via ChatSocket (Socket.IO)
  • Message edit/delete with onMessageUpdated listener
  • Emoji reactions (REST + socket)
  • Server-side message search within a conversation
  • Push device registration (registerDevice / unregisterDevice)
  • English and Arabic i18n with RTL support

Install #

Add to your app's pubspec.yaml:

dependencies:
  rasel_chatting_sdk: ^0.2.3
flutter pub get

Quick start — drop-in UI #

import 'package:flutter/material.dart';
import 'package:rasel_chatting_sdk/rasel_chatting_sdk.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(
    RaselChatApp(
      config: ChattingSdkConfig(
        sdkKey: 'csk_sdk_…', // from your tenant dashboard
        apiBaseUrl: 'https://api.your-domain.com',
      ),
    ),
  );
}

RaselChatApp handles SDK initialization, session restore, theme/locale preferences, and the full chat experience (login → chat list → conversations → settings).

Platform setup (required for media and voice) #

The SDK cannot inject permissions into your host app. Copy these from the reference demo app:

Android (android/app/src/main/AndroidManifest.xml):

  • INTERNET, CAMERA, RECORD_AUDIO
  • READ_MEDIA_IMAGES, READ_MEDIA_VIDEO, READ_MEDIA_AUDIO (API 33+)
  • READ_EXTERNAL_STORAGE / WRITE_EXTERNAL_STORAGE (API 32 and below)
  • Intent queries for camera, gallery, and document pickers

iOS (ios/Runner/Info.plist):

  • NSCameraUsageDescription
  • NSMicrophoneUsageDescription
  • NSPhotoLibraryUsageDescription
  • NSPhotoLibraryAddUsageDescription

Embed in an existing app #

Push RaselChatApp as a full-screen route. Pass sessionToken (the chat JWT from your backend) to skip the SDK login screen, and onExit so chat can return to the host:

Navigator.of(context).push(
  MaterialPageRoute(
    builder: (context) => RaselChatApp(
      config: ChattingSdkConfig(
        sdkKey: 'csk_sdk_…',
        apiBaseUrl: 'https://api.your-domain.com',
      ),
      sessionToken: hostChatJwt,
      initialLocale: 'ar',
      onExit: () => Navigator.of(context).pop(),
      hostTheme: const RaselChatTheme(
        primary: Color(0xFF1A1A5E),
        accent: Color(0xFFD4AC3A),
        fontFamily: 'Tajawal',
        lockAppearance: true,
      ),
    ),
  ),
);

Call RaselChatApp.clearPersistedSession() when the host user logs out.

Advanced — headless API client #

Use the REST/WebSocket client directly when building a custom UI:

import 'package:flutter/widgets.dart';
import 'package:rasel_chatting_sdk/rasel_chatting_sdk.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await ChattingSdk.initialize(
    ChattingSdkConfig(
      sdkKey: 'csk_sdk_…',
      apiBaseUrl: 'https://api.your-domain.com',
      locale: 'en',
    ),
  );

  runApp(const MyApp());
}

// Recommended: your backend mints a chat JWT after the user signs in.
final session = await ChattingSdk.instance.connectWithAccessToken(chatToken);

final groups = await ChattingSdk.instance.listGroups(session.accessToken);

final socket = ChattingSdk.instance.createChatSocket();
socket.connect(token: session.accessToken, userId: session.user.id);
socket.onMessage((message) => print(message.content));
socket.onMessageUpdated((message) => print('updated: ${message.id}'));
await socket.joinGroup(groups.first.id);

SDK key vs chat login #

Step Credential Purpose
ChattingSdk.initialize / RaselChatApp SDK key (csk_sdk_…) Binds your app to a tenant workspace
connectWithAccessToken Chat JWT from your backend Attaches session — no chat password on device
login (legacy) Chat user or employer email + password Chat users and employer staff accounts

Push notifications #

  1. Obtain a device token from your push provider (e.g. firebase_messaging).
  2. Register it after login:
await ChattingSdk.instance.registerDevice(
  session.accessToken,
  fcmToken,
  platform: 'android', // or ios / web
);
  1. Toggle delivery with updateProfile(..., notificationsEnabled: true/false).
  2. Call unregisterDevice on logout.

The server delivers pushes when FCM_SERVER_KEY is configured on the API.

Server-side session minting #

Never ship your tenant API key in a mobile client. Mint chat sessions on your backend:

// Server-side only (Dart backend or via your own API):
final session = await ChattingSdk.instance.mintChatSession(
  apiKey: tenantApiKey,
  externalId: user.id,
  email: user.email,
  name: user.name,
);
// Return session.accessToken to the mobile app.

More information #

License #

MIT — see LICENSE.

1
likes
120
points
233
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter client for the Rasel Chatting SDK — REST API, WebSocket chat, groups, media, reactions, search, push registration, and a drop-in WhatsApp-style chat UI.

Homepage
Repository (GitLab)
View/report issues

Topics

#chat #messaging #websocket #realtime #sdk

License

MIT (license)

Dependencies

archive, audio_waveforms, cupertino_icons, file_picker, flutter, flutter_localizations, flutter_secure_storage, google_fonts, html, http, http_parser, image_picker, intl, open_filex, path_provider, pdfx, permission_handler, provider, record, shared_preferences, socket_io_client, video_player, video_thumbnail

More

Packages that depend on rasel_chatting_sdk