ChatController constructor

ChatController({
  1. Client? httpClient,
  2. TextEditingController? textEditingController,
  3. ScrollController? scrollController,
  4. FocusNode? focusNode,
  5. ParamsChatBot? params,
  6. String? apiKey,
  7. ChatBotDatasource? datasource,
})

Interface default implementation for chat bot

Implementation

ChatController({
  http.Client? httpClient,
  TextEditingController? textEditingController,
  ScrollController? scrollController,
  FocusNode? focusNode,
  ParamsChatBot? params,
  String? apiKey,
  ChatBotDatasource? datasource,
})  : assert(
          (datasource != null && apiKey == null) ||
              (datasource == null && apiKey != null),
          "Either datasource or apiKey must be provided"),
      _params = params ?? const ParamsChatBot(),
      focusNode = focusNode ?? FocusNode(),
      textEditingController =
          textEditingController ?? TextEditingController(),
      scrollController = scrollController ?? ScrollController(),
      _apiDatasource = datasource ??
          ApiDatasourceImpl(
              apiKey: apiKey!,
              params: params ?? const ParamsChatBot(),
              httpClient: httpClient);