solidchat 0.0.5 copy "solidchat: ^0.0.5" to clipboard
solidchat: ^0.0.5 copied to clipboard

PlatformiOSmacOS

SolidChat SDK for Flutter

SolidChat Flutter SDK #

A Flutter SDK for integrating the SolidChat customer messaging platform into your Flutter applications.

pub package

Features #

  • Seamless integration with SolidChat platform
  • Customer support chat widget
  • Knowledge base access
  • User identification and tracking
  • Customizable UI components

Installation #

Add the following to your pubspec.yaml:

dependencies:
  solidchat: ^0.0.1

Then run:

flutter pub get

Usage #

Initialize the SDK #

Initialize the SDK with your SolidChat API key:

void main() {
  SolidChat.initialize(key: 'YOUR_SOLIDCHAT_API_KEY');
  runApp(MyApp());
}

Identify Users #

Optionally identify your users to track them across sessions and provide personalized support:

await SolidChat.identify(
  userId: 'user123',
  properties: VisitorProperties(
    email: 'user@example.com',
    name: 'John Doe',
    city: 'New York',
    country: 'USA',
    phone: '+1234567890',
  ),
);

Open the Chat Widget #

Open the chat widget from anywhere in your app:

// Open with default home tab
SolidChat.open(context);

// Or specify an initial tab
SolidChat.open(context, initialTab: SolidChatTab.conversations);
SolidChat.open(context, initialTab: SolidChatTab.knowledgeBase);

Close the Chat Widget Programmatically #

SolidChat.close();

Available Tabs #

  • SolidChatTab.home - Main chat interface
  • SolidChatTab.conversations - User's conversation history
  • SolidChatTab.knowledgeBase - Help articles and documentation

Example #

import 'package:flutter/material.dart';
import 'package:solidchat/solidchat.dart';
import 'package:solidchat/dto/visitor_properties.dart';
import 'package:solidchat/options.dart';

void main() async {
  SolidChat.initialize(key: 'YOUR_SOLIDCHAT_API_KEY');
  await SolidChat.identify(
    userId: 'user123',
    properties: VisitorProperties(
      email: 'user@example.com',
      name: 'John Doe',
    ),
  );
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('SolidChat Example')),
        body: const Center(child: Text('SolidChat Example')),
        floatingActionButton: FloatingActionButton(
          onPressed: () => SolidChat.open(context),
          tooltip: 'Open chat',
          child: const Icon(Icons.chat),
        ),
      ),
    );
  }
}

Requirements #

  • Flutter 3.7.2 or higher
  • Dart 3.0.0 or higher

License #

This project is licensed under the LICENSE file in the repository.

Learn More #

For more information, visit solidchat.io.