You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ A `Repository` to handles data operations. It knows where to get the data from a
18
18
19
19
*`onReady` - informs the presentation layer that view is in it's initial state, and no action has taken place yet,
20
20
*`onLoading` - informs the presentation layer that the data is being loaded, so it can display a loading indicator,
21
-
*`onRefreshing` - informs the presentation layer that the data is being refreshed, so it can display a refresh indicator or/and the current state of list elements,
21
+
*`onRefreshing` - informs the presentation layer that the data is being refreshed, so it can display a refresh indicator or/and the current state of list items,
22
22
*`onSuccess` - informs the presentation layer that the loading is completed and a `nonnull` and not empty data was retrieved,
23
23
*`onEmpty` - informs the presentation layer that the loading is completed, but `null` or empty data was retrieved,
24
24
*`onError` - informs the presentation layer that the loading or refreshing has ended with an error. It also provides an error that has occurred.
@@ -36,7 +36,7 @@ A `Repository` to handles data operations. It knows where to get the data from a
36
36
## Features
37
37
38
38
### ListBloc
39
-
The most basic use case. Allows to fetch, refresh and display a list of elements without filtering and pagination. Thus, `ListBloc` should be used only with a reasonable amount of data. `ListBloc` provides the methods for loading and refreshing data: `loadElements()` and `refreshElements()`. The former is most suitable for initial data fetch or for retry action when the first fetch fails. The latter is designed for being called after the initial fetch succeeds. It can be performed when the list has already been loaded. To display the current view state `ListBloc` cooperates with `BlocBuilder` as well as `ViewStateBuilder`.
39
+
The most basic use case. Allows to fetch, refresh and display a list of items without filtering and pagination. Thus, `ListBloc` should be used only with a reasonable amount of data. `ListBloc` provides the methods for loading and refreshing data: `loaditems()` and `refreshitems()`. The former is most suitable for initial data fetch or for retry action when the first fetch fails. The latter is designed for being called after the initial fetch succeeds. It can be performed when the list has already been loaded. To display the current view state `ListBloc` cooperates with `BlocBuilder` as well as `ViewStateBuilder`.
40
40
41
41
##### ListRepository
42
42
@@ -45,7 +45,7 @@ A `ListRepository` implementation should provide only one method:
45
45
`Future<List<T>> getAll();` - this method is responsible for providing all the data to the `ListBloc`.
46
46
47
47
Where:
48
-
*`T` is the element type returned by this repository.
48
+
*`T` is the item type returned by this repository.
49
49
50
50
##### Usage
51
51
@@ -58,11 +58,11 @@ An extension to the `ListBloc` that allows filtering.
58
58
59
59
`FilterListRepository` provides two methods:
60
60
61
-
`Future<List<T>> getAll();` - this method is called when a `null` filter is provided and should return all elements,
62
-
`Future<List<T>> getBy(F filter);` - this method is called with `nonnull` filter and should return only elements that match it.
61
+
`Future<List<T>> getAll();` - this method is called when a `null` filter is provided and should return all items,
62
+
`Future<List<T>> getBy(F filter);` - this method is called with `nonnull` filter and should return only items that match it.
63
63
64
64
Where:
65
-
*`T` is the element type returned by this repository,
65
+
*`T` is the item type returned by this repository,
66
66
*`F` is the filter type, which can be primitive as well as complex object.
67
67
68
68
#### Usage
@@ -76,16 +76,16 @@ A list BLoC with pagination but without filtering. It works best with [Infinite
76
76
Contains information about the current page, this is `number` and `size`.
77
77
78
78
#### PagedList
79
-
List of elements with information if there are more elements or not.
79
+
List of items with information if there are more items or not.
80
80
81
81
#### PagedListRepository
82
82
`PagedListRepository` comes with only one method:
83
83
84
-
`Future<List<T>> getAll(Page page);` - this method retrieves elements meeting the pagination restriction provided by the `page` object.
85
-
When elements are exceeded it should return an empty list or throw `PageNotFoundException`. `PagedListBloc` will handle both cases in the same way.
84
+
`Future<List<T>> getAll(Page page);` - this method retrieves items meeting the pagination restriction provided by the `page` object.
85
+
When items are exceeded it should return an empty list or throw `PageNotFoundException`. `PagedListBloc` will handle both cases in the same way.
86
86
87
87
Where:
88
-
*`T` is the element type returned by this repository.
88
+
*`T` is the item type returned by this repository.
89
89
90
90
#### Usage
91
91
@@ -98,34 +98,34 @@ A list BLoC with pagination and filtering. It works best with [Infinite Widgets]
98
98
Contains information about the current page, this is `number` and `size`.
99
99
100
100
#### PagedList
101
-
List of elements with information if there are more elements or not.
101
+
List of items with information if there are more items or not.
102
102
103
103
#### PagedListFilterRepository
104
104
`PagedListFilterRepository` provides only two methods:
105
105
106
-
`Future<List<T>> getAll(Page page);` - retrieves elements meeting the pagination restriction provided by the `page` object.
107
-
`Future<List<T>> getBy(Page page, F filter);` - retrieves elements meeting pagination as well as the filter restrictions provided by the `page` and `filter` objects.
106
+
`Future<List<T>> getAll(Page page);` - retrieves items meeting the pagination restriction provided by the `page` object.
107
+
`Future<List<T>> getBy(Page page, F filter);` - retrieves items meeting pagination as well as the filter restrictions provided by the `page` and `filter` objects.
108
108
109
-
When elements are exceeded it should return an empty list or throw `PageNotFoundException`. `PagedListFilterBloc` will handle both cases in the same way.
109
+
When items are exceeded it should return an empty list or throw `PageNotFoundException`. `PagedListFilterBloc` will handle both cases in the same way.
110
110
111
111
Where:
112
-
*`T` is the element type returned by this repository,
112
+
*`T` is the item type returned by this repository,
113
113
*`F` is the filter type, which can be primitive as well as complex object.
114
114
115
115
#### Usage
116
116
117
117
[Paged List BLoC Sample App](example/lib/src/list_paged_filter_app.dart)
118
118
119
119
### DetailsBloc
120
-
A BLoC that allows to fetch a single element with given identifier.
120
+
A BLoC that allows to fetch a single item with given identifier.
121
121
122
122
#### DetailsRepository
123
123
`DetailsRepository` comes with only one method:
124
124
125
-
`Future<T> getById(I id);` - this method retrieves an element with given id. When there's no element matching the id the `null` should be returned or `ElementNotFoundException` should be thrown. In both cases the `DetailsBloc` will emit `Empty` state.
125
+
`Future<T> getById(I id);` - this method retrieves an item with given id. When there's no item matching the id the `null` should be returned or `itemNotFoundException` should be thrown. In both cases the `DetailsBloc` will emit `Empty` state.
126
126
127
127
Where:
128
-
*`T` is the element type returned by this repository,
128
+
*`T` is the item type returned by this repository,
129
129
*`I` is the id type, it can be primitive as well as a complex object.
0 commit comments