startChat static method

Future<void> startChat({
  1. bool? isDarkTheme,
  2. Color? primaryColor,
  3. bool isPreChatFormEnabled = true,
  4. bool isPreChatEmailField = true,
  5. bool isPreChatNameField = true,
  6. bool isPreChatPhoneField = true,
  7. bool isAgentAvailabilityEnabled = true,
  8. bool isChatTranscriptPromptEnabled = true,
  9. bool isOfflineFormEnabled = true,
  10. bool disableEndChatMenuAction = false,
  11. String? botName = 'Answer Bot',
  12. String? toolbarTitle = 'Contact Us',
  13. bool isFullscreen = false,
  14. String? close = 'Close',
})

Open chat modal.

Optionally set theme color on iOS using primaryColor

If isPreChatFormEnabled is true, the pre-chat form will be shown to the user.

If isAgentAvailabilityEnabled is true, offline message will be shown to the user in case no agent is available.

If isChatTranscriptPromptEnabled is true, users are asked if they want to request a chat transcript at the end of the chat.

If isOfflineFormEnabled is true, the offline form will be shown to the user.

If disableEndChatMenuAction is true, disable the end chat menu item

If isPreChatEmailField is false, The field email in pre-chat is hidden

If isPreChatNameField is false, The field name in pre-chat is hidden

If isPreChatPhoneField is false, The field phone in pre-chat is hidden Optionally set bot's name using botName Optionally set toolbarTitle using toolbarTitle If isFullscreen is true, the modal is open in fullscreen mode If close is provided, the close button will be shown with the provided text

Implementation

static Future<void> startChat({
  bool? isDarkTheme,
  Color? primaryColor,
  bool isPreChatFormEnabled = true,
  bool isPreChatEmailField = true,
  bool isPreChatNameField = true,
  bool isPreChatPhoneField = true,
  bool isAgentAvailabilityEnabled = true,
  bool isChatTranscriptPromptEnabled = true,
  bool isOfflineFormEnabled = true,
  bool disableEndChatMenuAction = false,
  String? botName = 'Answer Bot',
  String? toolbarTitle = 'Contact Us',
  bool isFullscreen = false,
  String? close = 'Close',
}) async {
  await _channel.invokeMethod<void>('startChat', {
    'isDarkTheme': isDarkTheme,
    'primaryColor': primaryColor?.value,
    'isPreChatFormEnabled': isPreChatFormEnabled,
    'isPreChatEmailField': isPreChatEmailField,
    'isPreChatNameField': isPreChatNameField,
    'isPreChatPhoneField': isPreChatPhoneField,
    'isAgentAvailabilityEnabled': isAgentAvailabilityEnabled,
    'isChatTranscriptPromptEnabled': isChatTranscriptPromptEnabled,
    'isOfflineFormEnabled': isOfflineFormEnabled,
    'disableEndChatMenuAction': disableEndChatMenuAction,
    'toolbarTitle': toolbarTitle,
    'botName': botName,
    'isFullscreen': isFullscreen,
    'close': close,
  });
}