Nested Resources Adapter

Here’s how you could access nested resources such as: /posts/1/comments

mixin NestedURLAdapter on RemoteAdapter<Comment> {
  // ...
  @override
  String urlForFindAll(params) => '/posts/${params['postId']}/comments';

  // or even
  @override
  String urlForFindAll(params) {
    final postId = params['postId'];
    if (postId != null) {
      return '/posts/${params['postId']}/comments';
    }
    return super.urlForFindAll(params);
  }
}

and call it like:

final comments = await commentRepository.findAll(params: {'postId': post.id });