Skip to content
Permalink
Browse files

The `attributes` parameter of the `Sort` constructor is now optional

  • Loading branch information...
cedx committed Jun 12, 2019
1 parent 097b4be commit 965fc2fbd8197ca3b801c25eaf2b223b53b29b38
Showing with 3 additions and 3 deletions.
  1. +1 −1 lib/src/models/sort.dart
  2. +2 −2 test/models/sort_test.dart
@@ -4,7 +4,7 @@ part of '../../ngx_core.dart';
class Sort {

/// Creates a new sort.
Sort(Map<String, SortDirection> attributes, {this.separator = ',', this.sortParam = 'sort'}): attributes = attributes ?? <String, SortDirection>{};
Sort({Map<String, SortDirection> attributes, this.separator = ',', this.sortParam = 'sort'}): attributes = attributes ?? <String, SortDirection>{};

/// A map specifying the attributes to be sorted and their sort direction.
final Map<String, SortDirection> attributes;
@@ -10,7 +10,7 @@ void main() => group('Pagination', () {
'name': SortDirection.descending
};

final params = Sort(attributes).toQueryParameters();
final params = Sort(attributes: attributes).toQueryParameters();
expect(params['sort'], 'age,-name');
});

@@ -20,7 +20,7 @@ void main() => group('Pagination', () {
'name': SortDirection.descending
};

final params = Sort(attributes, separator: ':', sortParam: 'orderBy').toQueryParameters();
final params = Sort(attributes: attributes, separator: ':', sortParam: 'orderBy').toQueryParameters();
expect(params['sort'], isNull);
expect(params['orderBy'], 'age:-name');
});

0 comments on commit 965fc2f

Please sign in to comment.
You can’t perform that action at this time.