en_bot_sdk
Getting Started
en_bot_sdk plugin is used for integrating ENChatBot mobile SDK into your flutter project.
Usage
Run this command:
With Dart:
$ dart pub add en_bot_sdk
With Flutter:
$ flutter pub add en_bot_sdk
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
en_bot_sdk: ^1.1.2
Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:en_bot_sdk/en_bot_sdk.dart';
EnBotSdk sdk = EnBotSdk();
Object? doneObejct = await sdk.launchBot(context,
"<bot Key>",
"<bot Name>",
"<branding Key>",
"<user Id>",
100 , // <Chat history limit>
false, // <show done button>
EnBotSdk_LanguageDirection.defaultDirection, //<Language direction>
"<fonts/font name for header>",
"<fonts/font name for sub header>",
"<Assets/Images/image name>",
true
);
Android
Change minimum sdk version in Android/App/build.gradle
defaultConfig {
...
minSdkVersion 21
...
}
iOS
- Go to file ios/Podfile
platform :ios, '12.0'
- Add following snippet at the end of the podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
Issues and workaround
If you get below error while running for iOS
Building Flutter app for iOS - "GeneratedPluginRegistrant.m:12:9: Module 'en_bot_sdk' not found"
- Please restart your simulator
- flutter clean
- Re-run the flutter project once.
LICENSE
The code under MIT style.