Add live chat support to your Flutter app with the HelpLane SDK.
- Flutter 3.10+
- Dart 3.0+
Add the package to your pubspec.yaml:
dependencies:
helplane_flutter: ^1.0.0Then run:
flutter pub getimport 'package:helplane_flutter/helplane_flutter.dart';
void main() {
HelpLane.configure(brandToken: 'your-brand-token');
runApp(MyApp());
}HelpLane.identify(HelpLaneUser(
id: 'user-123',
name: 'John Doe',
email: '[email protected]',
));// Open as modal bottom sheet
ElevatedButton(
onPressed: () => HelpLane.openChat(context),
child: Text('Get Help'),
)
// Or embed directly
Scaffold(
body: HelpLaneChat(),
)HelpLane uses OneSignal for push notifications:
import 'package:helplane_flutter/helplane_flutter.dart';
import 'package:onesignal_flutter/onesignal_flutter.dart';
// After OneSignal initialization and user identification
final externalId = HelpLanePush.getExternalUserId();
if (externalId != null) {
OneSignal.login(externalId);
}
// Handle notification tap
OneSignal.Notifications.addClickListener((event) {
if (HelpLanePush.isHelpLaneNotification(event.notification.additionalData)) {
HelpLane.openChat(context);
}
});HelpLane.configure(
brandToken: 'your-brand-token',
baseUrl: 'https://your-instance.helplane.io', // Optional
);| Method | Description |
|---|---|
configure(brandToken, baseUrl) |
Initialize the SDK |
identify(user) |
Set the current user |
clearUser() |
Clear user data |
openChat(context) |
Open chat as modal |
currentUser |
Get current user |
isConfigured |
Check if SDK is configured |
| Property | Type | Description |
|---|---|---|
id |
String | Unique user identifier (required) |
name |
String? | Display name |
email |
String? | Email address |
avatarUrl |
String? | Profile image URL |
customAttributes |
Map? | Custom data |
| Property | Type | Description |
|---|---|---|
onLoad |
VoidCallback? | Called when chat loads |
onError |
Function(String)? | Called on error |
- Issues: GitHub Issues
MIT License - see LICENSE for details.