ChatProvider constructor

ChatProvider({
  1. required ChatController controller,
  2. required String chatId,
  3. required ChatConfig config,
})

Creates a new ChatProvider.

Automatically sets up listeners on inputController and controller to notify listeners when input changes or when the controller state changes.

All parameters are required:

  • controller: The ChatController to use for operations
  • chatId: The ID of the chat to manage messages for
  • config: The ChatConfig for validation and configuration

Implementation

ChatProvider({
  required this.controller,
  required this.chatId,
  required this.config,
}) {
  inputController.addListener(() {
    notifyListeners();
  });
  // Listen to controller changes to propagate them to UI
  controller.addListener(_onControllerChange);
}