ChatController constructor
ChatController({
- Client? httpClient,
- TextEditingController? textEditingController,
- ScrollController? scrollController,
- FocusNode? focusNode,
- ParamsChatBot? params,
- String? apiKey,
- 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);