{"id":15546641,"url":"https://github.com/xsahil03x/super_paging","last_synced_at":"2025-04-14T13:11:37.001Z","repository":{"id":205776493,"uuid":"666327344","full_name":"xsahil03x/super_paging","owner":"xsahil03x","description":"Add pagination or load more or infinite scrolling functionality to your flutter list view with ease.","archived":false,"fork":false,"pushed_at":"2024-09-26T10:16:51.000Z","size":12842,"stargazers_count":32,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-09T13:11:20.178Z","etag":null,"topics":["bi-directional","endless-scroll","endless-scrolling","endless-scrolling-flutter","flutter","infinite-scroll","infinite-scrolling","load-more","load-more-flutter","pagination","paging-library","paging-library-in-android","paging2","paging3"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/super_paging","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xsahil03x.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-14T08:37:34.000Z","updated_at":"2024-09-28T07:30:36.000Z","dependencies_parsed_at":"2024-11-01T04:06:32.398Z","dependency_job_id":"b8ff4e6d-ea64-4d0d-9ac4-977661c8120a","html_url":"https://github.com/xsahil03x/super_paging","commit_stats":{"total_commits":35,"total_committers":2,"mean_commits":17.5,"dds":0.08571428571428574,"last_synced_commit":"4d250a74aef924e005224bf5fd9c5fb1208769e9"},"previous_names":["xsahil03x/super_pager"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsahil03x%2Fsuper_paging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsahil03x%2Fsuper_paging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsahil03x%2Fsuper_paging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsahil03x%2Fsuper_paging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xsahil03x","download_url":"https://codeload.github.com/xsahil03x/super_paging/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248886324,"owners_count":21177643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bi-directional","endless-scroll","endless-scrolling","endless-scrolling-flutter","flutter","infinite-scroll","infinite-scrolling","load-more","load-more-flutter","pagination","paging-library","paging-library-in-android","paging2","paging3"],"created_at":"2024-10-02T13:03:07.099Z","updated_at":"2025-04-14T13:11:35.964Z","avatar_url":"https://github.com/xsahil03x.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Super Paging\n\n[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://opensource.org/licenses/MIT)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/xsahil03x/multi_trigger_autocomplete/blob/master/LICENSE)\n[![Dart CI](https://github.com/xsahil03x/super_paging/workflows/super_paging/badge.svg)](https://github.com/xsahil03x/super_paging/actions)\n[![Version](https://img.shields.io/pub/v/super_paging.svg)](https://pub.dartlang.org/packages/super_paging)\n\nSimplify Flutter pagination with Super Paging — A super package providing efficient data management, in-memory caching,\nconfigurable widgets and built-in error handling for a seamless pagination experience.\n\nLive Demo: https://xsahil03x.github.io/super_paging\n\n**Show some ❤️ and star the repo to support the project**\n\n\u003ckbd\u003e\n  \u003cimg src=\"https://github.com/xsahil03x/super_paging/blob/main/asset/package_demo.gif?raw=true\" alt=\"An animated image of the SuperPaging\" height=\"400\"/\u003e\n\u003c/kbd\u003e\n\n## Features\n\n- **In-memory Caching**: Intelligently caches frequently accessed data, minimizing network requests and significantly\n  improving performance.\n- **Configurable Widgets**: Customize the look and feel of your pagination with a variety of built-in widgets,\n  like `PagingListView` and `BidirectionalPagingListView`.\n- **Error Handling**: Gracefully handles potential errors during data loading and retrieval, ensuring a smooth user\n  experience even in unexpected situations.\n- **Flexible Configuration**: Tailor Pager's behavior to your specific needs by adjusting parameters like initial\n  keys, page sizes, and caching strategies.\n- **Extensive Documentation**: Clear and comprehensive documentation, making it easy for developers of all levels to\n  understand and implement effectively.\n\n## Installation\n\nAdd the following to your  `pubspec.yaml`  and replace  `[version]`  with the latest version:\n\n```yaml\ndependencies:\n  super_paging: ^[version]\n```\n\n## Usage\n\nTo get started, import the package:\n\n```dart\nimport 'package:super_paging/super_paging.dart';\n```\n\nCreate a `PagingSource`:\n\n```dart\nclass RickAndMortySource extends PagingSource\u003cint, Character\u003e {\n  final RickAndMortyApi api;\n\n  RickAndMortySource({required this.api});\n\n  @override\n  Future\u003cLoadResult\u003cint, Character\u003e\u003e load(LoadParams\u003cint\u003e params) async {\n    try {\n      final characters = await api.getCharacters(page: key);\n      return LoadResult.page(nextKey: key + 1, items: characters);\n    } catch (e) {\n      return LoadResult.error(e);\n    }\n  }\n}\n```\n\nCreate a `Pager` Instance:\n\n```dart\nfinal pager = Pager(\n  initialKey: 1,\n  config: const PagingConfig(pageSize: 20, initialLoadSize: 60),\n  pagingSourceFactory: () =\u003e RickAndMortySource(api: RickAndMortyApi()),\n);\n```\n\nIntegrate with UI:\n\n```dart\nPagingListView(\n  pager: pager,\n  itemBuilder: (BuildContext context, int index) {\n    final item = pager.items.elementAt(index);\n    return ListTile(\n      title: Text(item.name),\n      subtitle: Text(item.species),\n      trailing: Text('# ${item.id}'),\n      leading: CircleAvatar(backgroundImage: NetworkImage(item.image)),\n    );\n  },\n  emptyBuilder: (BuildContext context) {\n    return const Center(\n      child: Text('No characters found'),\n    );\n  },\n  errorBuilder: (BuildContext context, Object? error) {\n    return Center(child: Text('$error'));\n  },\n  loadingBuilder: (BuildContext context) {\n    return const Center(\n      child: CircularProgressIndicator.adaptive(),\n    );\n  },\n);\n```\n\nHandle Refresh and Retry:\n\n```dart\n// Refresh the data\nawait pager.refresh();\n\n// Retry failed loads\nawait pager.retry();\n```\n\nDispose Resources:\n\n```dart\n@override\nvoid dispose() {\n  pager.dispose();\n  super.dispose();\n}\n```\n\n## Customization\n\n### Pager\n\n```dart\nPager(\n  // Defines the initial key to use for the first load.\n  //\n  // By default, the initial key is null.\n  initialKey: null,\n\n  // Configuration for pagination behavior.\n  config: PagingConfig(\n    // Defines the number of items to load in a single page.\n    pageSize: 20,\n    \n    // Defines the number of items to load in the first page.\n    //\n    // By default, the initial load size is 3 times the page size.\n    initialLoadSize: 60,\n    \n    // Defines how far from the edge of loaded content an access\n    // must be to trigger further loading.\n    //\n    // By default, the pager will start loading when the user scrolls\n    // within 3 items of the end of the loaded content.\n    //\n    // If set to null, the pager will not start loading more content until\n    // they are specifically requested by the user.\n    prefetchIndex: 3,\n    \n    // @Experimental\n    //\n    // Defines the maximum number of items to keep in memory before\n    // pages should be dropped.\n    //\n    // If set to null (Default), pages will never be dropped.\n    maxSize: null,\n  ),\n  \n  // Defines the initial state to use for the first load.\n  //\n  // By default, [PagingState.initial()] state is used.\n  initialState: PagingState.initial(),\n\n  // Defines the source from which to load the paginated data.\n  pagingSourceFactory: () =\u003e MyPagingSource(),\n);\n```\n\n### PagingListView\n\n```dart\nPagingListView\u003cint, String\u003e(\n  // Defines the pager to use for loading data.\n  pager: myPager,\n\n  // Defines the builder that is called to build items in the ListView.\n  //\n  // The builder is called once for each item in the list.\n  itemBuilder: (context, index) {\n    final item = myPager.valueList.elementAt(index);\n    return ListTile(\n      title: Text(item),\n    );\n  },\n\n  // Defines the builder that is called to build the empty state of the list.\n  emptyBuilder: (context) {\n    return const Center(\n      child: Text('No items found'),\n    );\n  },\n\n  // Defines the builder that is called to build the error state of the list.\n  //\n  // [error] is the error that caused the state to be built.\n  errorBuilder: (context, error) {\n    return Center(child: Text('Error: $error'));\n  },\n\n  // Defines the builder that is called to build the loading state of the list.\n  loadingBuilder: (context) {\n    return const Center(\n      child: CircularProgressIndicator.adaptive(),\n    );\n  },\n\n  // Defines the builder that is called to build the prepend state of the list.\n  //\n  // [state] is the current state of the pager and [pager] is the pager instance.\n  //\n  // Optional. If not provided, the list will show the default prepend loading state.\n  prependStateBuilder: (context, state, pager) {\n    // Return a widget based on the state. For example, a button to load the previous page.\n    // Use the [pager] instance to call [pager.load()] or [pager.retry] based on the state.\n  },\n\n  // Defines the builder that is called to build the append state of the list.\n  //\n  // [state] is the current state of the pager and [pager] is the pager instance.\n  //\n  // Optional. If not provided, the list will show the default append loading state.\n  appendStateBuilder: (context, state, pager) {\n    // Return a widget based on the state. For example, a button to load the next page.\n    // Use the [pager] instance to call [pager.load()] or [pager.retry] based on the state.\n  },\n);\n```\n\n## License\n\n[MIT License](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsahil03x%2Fsuper_paging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxsahil03x%2Fsuper_paging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsahil03x%2Fsuper_paging/lists"}