CommentProvider constructor

CommentProvider({
  1. required CommentController controller,
  2. required String postId,
  3. required CommentValidator validator,
})

Creates a new CommentProvider.

Automatically loads comments for postId on initialization. Sets up a listener on inputController to notify listeners when input changes.

All parameters are required:

  • controller: The CommentController to use for operations
  • postId: The ID of the entity to manage comments for
  • validator: The CommentValidator to validate comment content

Implementation

CommentProvider({
  required this.controller,
  required this.postId,
  required this.validator,
}) {
  loadComments();
  inputController.addListener(() {
    notifyListeners();
  });
}