Nested Resources Adapter

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

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

  // or even
  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': });

Need professional help with Flutter?

Describe your project in detail and include your e-mail and budget.