bloc_pagination 0.0.3 bloc_pagination: ^0.0.3 copied to clipboard
Flutter package provide easiest way to handle pagination pages using flutter_bloc state management
BlocPagination #
Installing #
In your pubspec.yaml
dependencies:
bloc_pagination: //add latest version
import 'package:bloc_pagination/bloc_pagination.dart';
Basic Usage #
class MyBloc extends PaginationBloc {
@override
Future<ListResponse<PaginationModel>> findAll(int page,
{AbstractQueryParameters? queryParameters}) async {
/// your data source
return readRepository.findAll(page, params: queryParameters);
}
}
class MyWidget extends StatelessWidget {
final MyBloc bloc = MyBloc();
@override
Widget build(BuildContext context) {
return Scaffold(
body: BlocPagination<String,error>(
bloc: bloc,
builder: (BuildContext context, String item) {
return ListTile(
title: Text(item),
);
},
),
);
}
}
Additional information #
For more information on how to use the package, please refer to the official documentation.
I hope this helps! Let me know if you have any other questions.