robylon_flutter_sdk 0.0.1-staging.1
robylon_flutter_sdk: ^0.0.1-staging.1 copied to clipboard
Flutter SDK for Robylon - same logic and functionality as robylon-react-native-sdk.
Robylon Flutter SDK #
Flutter plugin that mirrors robylon-react-native-sdk in logic and functionality. Same features, APIs, and behavior as the React Native SDK, implemented for Flutter.
Installation #
Add to your pubspec.yaml:
dependencies:
robylon_flutter_sdk: ^2.0.30
Then run:
flutter pub get
Configuration (optional) #
Set base URLs and debug before using the SDK:
import 'package:robylon_flutter_sdk/robylon_flutter_sdk.dart';
void main() {
setRobylonFlutterSdkConfig(RobylonFlutterSdkConfig(
apiUrl: 'https://api.robylon.com',
baseChatbotDomain: 'https://your-chatbot-domain.com',
chatbotPath: 'path',
debug: false,
));
runApp(MyApp());
}
Usage #
Basic #
import 'package:robylon_flutter_sdk/robylon_flutter_sdk.dart';
class MyScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Chatbot(
apiKey: 'YOUR_API_KEY',
userId: 'optional_user_id',
userToken: 'optional_token',
userProfile: {
'email': 'user@example.com',
'name': 'John Doe',
'mobile': '+1234567890',
},
onEvent: (event) => print('Event: ${event.type}'),
onOpen: () => print('Opened'),
onClose: () => print('Closed'),
onReady: () => print('Ready'),
),
);
}
}
Imperative control (ref API) #
final controller = RobylonChatbotController();
// In build:
Chatbot(
apiKey: 'YOUR_API_KEY',
controller: controller,
showFloatingButton: false,
)
// Later:
if (controller.isReady()) {
controller.open();
// or controller.close(); controller.toggle();
}
Open chatbot in external browser #
import 'package:robylon_flutter_sdk/robylon_flutter_sdk.dart';
openChatbot('CHATBOT_ID', {'param': 'value'});
Exports #
- Chatbot – Main widget
- RobylonChatbotController – Ref-style open/close/toggle/isReady
- openChatbot – Open chatbot URL externally
- errorTracker / ErrorTrackingService – Error reporting
- ChatbotEventType, ChatbotEvent, ChatbotEventHandler – Events
- ChatbotConfig, LauncherType, WidgetPositionEnums, etc. – Types
- setRobylonFlutterSdkConfig / RobylonFlutterSdkConfig – Config
Events #
Same as the React Native SDK:
- CHATBOT_BUTTON_LOADED, CHATBOT_BUTTON_CLICKED
- CHATBOT_OPENED, CHATBOT_CLOSED
- CHATBOT_APP_READY, CHATBOT_LOADED
- CHAT_INITIALIZED, CHAT_INITIALIZATION_FAILED
- SESSION_REFRESHED
- REQUEST_MIC_PERMISSION, MIC_PERMISSION_GRANTED, MIC_PERMISSION_DENIED
Requirements #
- Flutter SDK
- Android / iOS (platform WebView)
- Valid Robylon API key
License #
ISC