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
Libraries
- chatbot_config_repository
- chatbot_events
- config/sdk_config
- constants/app_constants
- constants/error_constants
- constants/font_styles
- open_chatbot
- robylon_chatbot_controller
- robylon_flutter_sdk
- robylon_flutter_sdk_method_channel
- robylon_flutter_sdk_platform_interface
- services/error_tracking_service
- types/chatbot_config
- types/events
- utils/animations
- utils/color_utils
- utils/file_download
- utils/logger
- utils/system_info
- utils/web_view_storage
- widgets/chatbot_sdk
- widgets/chatbot_webview_layer
- widgets/error_boundary
- widgets/launchers/image_launcher
- widgets/launchers/text_launcher
- widgets/launchers/textual_image_launcher
- widgets/loading_indicator
- widgets/toast_widget