createPaginatedController<T, Q> function
AutoDisposeNotifierProvider<PaginatedSearchController<T, Q> , PaginatedState<T, Q> >
createPaginatedController<T, Q>({
- required SearchProvider<
T, Q> searchProvider, - int pageSize = PaginatedSearchController.defaultPageSize,
- Duration debounceDuration = PaginatedSearchController.defaultDebounceDuration,
- Q? initialQuery,
- bool debugLoggingEnabled = true,
Create a paginated controller provider easily. For example
final recipesPaginatedControllerProvider = createPaginatedController(searchProvider: RecipesSearchProvider());
This would simplify your controller creation and make your code easier to read.
Implementation
AutoDisposeNotifierProvider<PaginatedSearchController<T, Q>, PaginatedState<T, Q>>
createPaginatedController<T, Q>({
required SearchProvider<T, Q> searchProvider,
int pageSize = PaginatedSearchController.defaultPageSize,
Duration debounceDuration = PaginatedSearchController.defaultDebounceDuration,
Q? initialQuery,
bool debugLoggingEnabled = true,
}) {
return NotifierProvider.autoDispose(
() => PaginatedSearchController<T, Q>(
searchProvider: searchProvider,
pageSize: pageSize,
debounceDuration: debounceDuration,
initialPageQuery: initialQuery,
debugLoggingEnabled: debugLoggingEnabled,
),
);
}