erxes_flutter_sdk 0.1.0
erxes_flutter_sdk: ^0.1.0 copied to clipboard
Flutter plugin for the Erxes messenger, wrapping the native iOS and Android Erxes SDKs.
erxes_flutter_sdk #
Flutter plugin for the Erxes messenger. It wraps the native
Erxes SDKs — MessengerSDK (iOS) and io.github.munkhorgilb:messenger-sdk
(Android) — behind one idiomatic Dart API built on platform channels.
Repository:
erxes-flutter-sdk· Package name:erxes_flutter_sdk(pub package names usesnake_case).
Platform support #
| Feature | iOS | Android |
|---|---|---|
| Chat mode (full screen) | ✅ | ✅ |
| Voice messages | ✅ | ✅ |
customData on user |
✅ | ❌ (ignored by native SDK) |
This plugin targets chat mode only.
Install #
dependencies:
erxes_flutter_sdk:
git:
url: https://github.com/Munkhorgilb/flutter-sdk.git
iOS setup #
-
Minimum iOS 16.0, Swift 5.9.
-
The underlying
erxes-ios-sdkis distributed via Swift Package Manager only, so enable Flutter's SPM support in the host app:flutter config --enable-swift-package-manager -
For voice messages, add to
ios/Runner/Info.plist:<key>NSMicrophoneUsageDescription</key> <string>Used to record voice messages in support chat.</string> <key>NSSpeechRecognitionUsageDescription</key> <string>Used to transcribe voice messages in support chat.</string>
Android setup #
- Minimum
minSdk24, Java/Kotlin JVM target 17. - The native SDK (
io.github.munkhorgilb:messenger-sdk) is pulled from Maven Central automatically. - Release builds: the plugin ships consumer ProGuard rules that keep Material icon and Erxes SDK classes used to resolve action icons by name.
Usage #
import 'package:erxes_flutter_sdk/erxes_flutter_sdk.dart';
// Listen for header / drawer action taps.
final sub = ErxesMessenger.onAction.listen((id) {
if (id == 'close') Navigator.of(context).pop();
});
await ErxesMessenger.configure(
integrationId: 'YOUR_INTEGRATION_ID',
endpoint: 'https://yourcompany.erxes.io', // or serverUrl / subDomain
primaryColor: '#7c3aed',
user: const ErxesUser(name: 'Jane Doe', email: 'user@example.com'),
homeActions: const [
ErxesAction(id: 'close', title: 'Close', iosIcon: 'xmark', androidIcon: 'Close'),
],
);
See example/ for a full settings → support → chat flow.
API #
| Method | Description |
|---|---|
configure({...}) |
Configure and (in chat mode) present the messenger. |
setUser(ErxesUser) |
Update the current customer identity. |
clearUser() |
Clear the current customer identity. |
showMessenger() |
Present the chat messenger UI. |
hideMessenger() |
Dismiss the messenger (no-op on Android). |
onAction |
Stream<String> of tapped action ids. |
onReady |
Stream<void> emitted when the messenger is ready. |
Models #
ErxesUser({ email, phone, name, customData })ErxesAction({ id, title, iosIcon, androidIcon })
Releasing #
CI (.github/workflows/ci.yml) runs format, analyze and tests on every push/PR.
Publishing to pub.dev is automated via
.github/workflows/publish.yml and OIDC (no secret tokens):
-
One-time: on pub.dev, enable Automated publishing for this package and trust the
Munkhorgilb/flutter-sdkGitHub repository (see dart.dev/tools/pub/automated-publishing). -
Bump
version:inpubspec.yamland updateCHANGELOG.md. -
Tag and push:
git tag v0.1.0 git push origin v0.1.0
The workflow validates and runs dart pub publish for the tagged version.
Troubleshooting #
- iOS build can't find
MessengerSDK— enable Swift Package Manager:flutter config --enable-swift-package-manager, thenflutter cleanand rebuild. - Android action icons missing in release — confirm minification didn't strip
icon classes; the bundled
consumer-rules.proshould cover this.