{"id":21748396,"url":"https://github.com/surfstudio/flutter-datalist","last_synced_at":"2025-07-19T00:32:01.376Z","repository":{"id":45561628,"uuid":"384332930","full_name":"surfstudio/flutter-datalist","owner":"surfstudio","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-26T13:35:37.000Z","size":29,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2023-08-01T12:24:27.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/surfstudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-09T05:38:33.000Z","updated_at":"2022-12-14T23:45:36.000Z","dependencies_parsed_at":"2023-01-21T19:30:44.505Z","dependency_job_id":null,"html_url":"https://github.com/surfstudio/flutter-datalist","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-datalist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-datalist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-datalist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-datalist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/surfstudio","download_url":"https://codeload.github.com/surfstudio/flutter-datalist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226462283,"owners_count":17629049,"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":[],"created_at":"2024-11-26T08:13:20.574Z","updated_at":"2024-11-26T08:13:21.395Z","avatar_url":"https://github.com/surfstudio.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data list\n\n[![Build Status](https://shields.io/github/actions/workflow/status/surfstudio/flutter-datalist/workflow.yaml?logo=github\u0026logoColor=white)](https://github.com/surfstudio/SurfGear/tree/main/packages/datalist)\n[![Coverage Status](https://img.shields.io/codecov/c/github/surfstudio/SurfGear?flag=datalist\u0026logo=codecov\u0026logoColor=white)](https://codecov.io/gh/surfstudio/SurfGear)\n[![Pub Version](https://img.shields.io/pub/v/datalist?logo=dart\u0026logoColor=white)](https://pub.dev/packages/datalist)\n[![Pub Likes](https://badgen.net/pub/likes/datalist)](https://pub.dev/packages/datalist)\n[![Pub popularity](https://badgen.net/pub/popularity/datalist)](https://pub.dev/packages/datalist/score)\n![Flutter Platform](https://badgen.net/pub/flutter-platform/datalist)\n\nThis package made by [Surf](https://surf.ru).\n\n## Description\n\n### Data list limit-offset\n\nThe main entity - [`OffsetDataList`][dl_offset] - a list for paginated data through the limit / offset mechanism\nHas methods:\n  1. `merge (DataList data)`, which allows you to combine 2 data blocks. The input should be only OffsetDataList\n  2. `int nextOffset` - returns the offset for the trace of the data block\n  3. `bool canGetMore` - indicates whether more data can be loaded\n  1. `#transform ()` - to convert data in a list\n\nIt can combine two subsequent blocks, and in reverse order.\n\n[dl_offset]: lib/src/impl/datalist_limit_offset.dart\n\n### Data list page-count\n\nThe main entity - [`PageCountDataList`][dl_pagecount] - a list of paginated data through the page / count mechanism\nHas methods:\n  1. `merge (DataList data)`, which allows you to combine 2 data blocks. Input should be only PageCount DataList\n  2. `int getNextPage ()` - returns the number of the trace of the data block\n  3. `bool canGetMore` - indicates whether more data can be loaded\n  1. `#transform ()` - to convert data in a list\n\nIt can combine two subsequent blocks, and in reverse order.\n\n[dl_pagecount]: lib/src/impl/datalist_page_count.dart\n\n## Installation\n\nAdd `datalist` to your `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  datalist: ^1.0.0\n```\n\nYou can use both `stable` and `dev` versions of the package listed above in the badges bar.\n\n## Example\n\nExample with OffsetDataList:\n```dart\nconst element0 = Element(0);\nconst element1 = Element(1);\nconst element2 = Element(2);\nconst element3 = Element(3);\nconst element4 = Element(4);\nconst element5 = Element(5);\nconst element6 = Element(6);\nconst element7 = Element(7);\nconst element8 = Element(8);\nconst element9 = Element(9);\n\nfinal list1 = OffsetDataList(\n  data: [element1, element2, element3, element4, element5],\n  limit: 5,\n  offset: 4,\n  totalCount: 30,\n);\n\nfinal list2 = OffsetDataList(\n  data: [element0, element1, element2, element3, element4],\n  limit: 5,\n  offset: 9,\n  totalCount: 30,\n);\n\nfinal list3 = OffsetDataList(\n  data: [element5, element6, element7, element8, element9],\n  limit: 5,\n  offset: 14,\n  totalCount: 30,\n);\n\nlist1\n  ..mergeWithPredicate(list2, (element) =\u003e element.id)\n  ..mergeWithPredicate(list3, (element) =\u003e element.id);\n\nfinal list4 = OffsetDataList(\n  data: [\n    element1,\n    element2,\n    element3,\n    element4,\n    element5,\n    element0,\n    element6,\n    element7,\n    element8,\n    element9,\n  ],\n  limit: 15,\n  offset: 4,\n  totalCount: 30,\n);\n\nexpect(list1, equals(list4)); // true\n```\nExample with PageCountDataList:\n```dart\nfinal list1 = PageCountDataList\u003cint\u003e(\n  data: [1, 2, 3, 4, 5],\n  startPage: 0,\n  numPages: 5,\n  pageSize: 1,\n);\nfinal list2 = PageCountDataList\u003cint\u003e(\n  data: [6, 7, 8, 9, 10],\n  startPage: 1,\n  numPages: 5,\n  pageSize: 1,\n);\nfinal list3 = PageCountDataList\u003cint\u003e(\n  data: [1, 6, 7, 8, 9, 10],\n  startPage: 0,\n  pageSize: 1,\n  numPages: 6,\n);\n\nlist1.merge(list2);\n\nexpect(list1, equals(list3)); // true\n```\n\n## Changelog\n\nAll notable changes to this project will be documented in [this file](./CHANGELOG.md).\n\n## Issues\n\nFor issues, file directly in the Issues section.\n\n## Contribute\n\nIf you would like to contribute to the package (e.g. by improving the documentation, solving a bug or adding a cool new feature), please review our [contribution guide](../../CONTRIBUTING.md) first and send us your pull request.\n\nYour PRs are always welcome.\n\n## How to reach us\n\nPlease feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.\n\n[![Telegram](https://img.shields.io/badge/chat-on%20Telegram-blue.svg)](https://t.me/SurfGear)\n\n## License\n\n[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fflutter-datalist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurfstudio%2Fflutter-datalist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fflutter-datalist/lists"}