Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This project is great. i want to know how to use usecase #4

Open
est7 opened this issue Jun 28, 2023 · 0 comments
Open

This project is great. i want to know how to use usecase #4

est7 opened this issue Jun 28, 2023 · 0 comments

Comments

@est7
Copy link

est7 commented Jun 28, 2023

My code is like this

class InitChatListUsecase {
  final IChatRepository repository;

  InitChatListUsecase({required this.repository});

  Future<Result<List<ChatModel>>> call() {
    return repository.getAllChatList();
  }
}

The code in the project looks like this

@riverpod
class DeleteTodoUseCaseImpl extends _$DeleteTodoUseCaseImpl
    implements DeleteTodoUseCase {
  @override
  Future<void> build(final int id) {
    final TodosRepository repository =
        ref.read(todosRepositoryImplProvider.notifier);
    return repository.deleteTodo(id);
  }
}

I want to know why Usecase is used as “StateNotifier” ?I'm a fresh on Riverpod, hope you can tell me about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant