launchBot method

Future<Object?> launchBot(
  1. BuildContext context,
  2. String botKey,
  3. String botName,
  4. String brandingKey,
  5. String userId,
  6. int chatHistorySize,
  7. bool showDone,
  8. EnBotSdk_LanguageDirection languageDirection,
  9. String headerTitleFont,
  10. String headerDescriptionFont,
  11. String sendMessageButtonIconPath,
)

launchBot

Will launch bot with specified botKey and other paramaters

Returns object in when user taps on done button (if enabled)

Implementation

Future<Object?> launchBot(
    BuildContext context,
    String botKey,
    String botName,
    String brandingKey,
    String userId,
    int chatHistorySize,
    bool showDone,
    EnBotSdk_LanguageDirection languageDirection,
    String headerTitleFont,
    String headerDescriptionFont,
    String sendMessageButtonIconPath) async {
  Uint8List? listData;
  if (sendMessageButtonIconPath != "") {
    try {
      final byteData = await rootBundle.load(sendMessageButtonIconPath);
      listData = Uint8List.view(byteData.buffer);
    } on Error catch (exception) {
      print("Exception loading image");
    }
  }

  Object? obj = await _channel.invokeMethod('launchBot', <String, dynamic>{
    'botKey': botKey,
    'botName': botName,
    'brandingKey': brandingKey,
    'userId': userId,
    'chatHistorySize': chatHistorySize,
    'showDone': showDone,
    'languageDirection': languageDirection.index,
    'headerTitleFont': headerTitleFont,
    'headerDescriptionFont': headerDescriptionFont,
    'sendMessageButtonIcon': listData ?? null
  });
}