{"id":15293171,"url":"https://github.com/marchdev-tk/flinq","last_synced_at":"2025-07-29T19:43:42.218Z","repository":{"id":56828890,"uuid":"240213654","full_name":"marchdev-tk/flinq","owner":"marchdev-tk","description":"Extended capabilities for collections. It's a bunch of shortcuts to avoid unnecessary boilerplate work with collections.","archived":false,"fork":false,"pushed_at":"2021-03-23T12:37:17.000Z","size":105,"stargazers_count":12,"open_issues_count":3,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-13T12:35:29.412Z","etag":null,"topics":["boilerplate","collection","collections","dart","dart-library","dart-package","dart3","dartlang","enumerable","extended-capabilities","iterable","linq","linq-expressions","linq-methods"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marchdev-tk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-13T08:42:27.000Z","updated_at":"2024-10-28T08:59:08.000Z","dependencies_parsed_at":"2022-08-29T00:20:28.453Z","dependency_job_id":null,"html_url":"https://github.com/marchdev-tk/flinq","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/marchdev-tk/flinq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchdev-tk%2Fflinq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchdev-tk%2Fflinq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchdev-tk%2Fflinq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchdev-tk%2Fflinq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marchdev-tk","download_url":"https://codeload.github.com/marchdev-tk/flinq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marchdev-tk%2Fflinq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267745956,"owners_count":24137984,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["boilerplate","collection","collections","dart","dart-library","dart-package","dart3","dartlang","enumerable","extended-capabilities","iterable","linq","linq-expressions","linq-methods"],"created_at":"2024-09-30T16:40:04.050Z","updated_at":"2025-07-29T19:43:42.076Z","avatar_url":"https://github.com/marchdev-tk.png","language":"Dart","readme":"# flinq\n\n![Build](https://github.com/marchdev-tk/flinq/workflows/build/badge.svg)\n[![codecov](https://codecov.io/gh/marchdev-tk/flinq/branch/master/graph/badge.svg)](https://codecov.io/gh/marchdev-tk/flinq)\n[![Pub](https://img.shields.io/pub/v/flinq.svg)](https://pub.dartlang.org/packages/flinq)\n![GitHub](https://img.shields.io/github/license/marchdev-tk/flinq)\n![GitHub stars](https://img.shields.io/github/stars/marchdev-tk/flinq?style=social)\n\nExtended capabilities for collections.\nIt's a bunch of shortcuts to avoid unnecesary boilerplate work with collections.\n\n## Getting Started\n\nThis package will help you to reduce the amount of boilerplate code by adding folowing extensions for `Iterable`s:\n\n* getter `firstOrNull` and method `firstOrNullWhere` for getting first value, and if it will not be found returns `null`\n\n* getter `lastOrNull` and method `lastOrNullWhere` for getting last value, and if it will not be found returns `null`\n\n* getter `singleOrNull` and method `singleOrNullWhere` for getting single value, and if it will not be found returns `null`, and if there will be too many elements it'll also return `null`\n\n* method `mapList`, which maps collection and casts it to `List`\n\n* method `whereList`, which filters collection and casts it to `List`\n\n* method `mapWhereList`, which maps collection, then filters it and then casts it to `List`\n\n* method `whereMapList`, which filters collection, then maps collection and then casts it to `List`\n\n* getter `notNull` for getting only **not null** values from the collection\n\n* method `group` and `groupMap` for grouping a collection\n\n* getter `min`/`minOrNull` and `max`/`maxOrNull` for getting minimal or maximal value from collection of `Comparable`s\n\n* method `minWhere`/`minOrNullWhere` and `maxWhere`/`maxOrNullWhere` for getting minimal or maximal value from filtered collection of `Comparable`s\n\n* getter `sum` and `average` for getting sum and average from collection of `num`s\n\n* method `sumWhere` and `averageWhere` for getting sum and average from filtered collection of `num`s\n\n* getter `distinct` and method `distinctWhere` which will return `List` with unique values in collection\n\n* method `union` and `unionWhere` which will return `List` with union of two collections with only unique values in resulting collection\n\n* method `intersection` and `intersectionWhere` which will return `List` with elements that contains both collections with only unique values in resulting collection\n\n* method `difference` and `differenceWhere` which will return `List` with difference between two collections with only unique values in resulting collection\n\n## Examples\n\n`Iterable` extension can be used like this:\n\n### Common\n\n* **firstOrNull** and **firstOrNullWhere**\n\n```dart\nfinal firstOrNull = [].firstOrNull; // null\n// or\nfinal firstOrNull = [3, 6, 2, 7, 9].firstOrNullWhere((item) =\u003e item \u003e 10); // null\n```\n\n* **lastOrNull** and **lastOrNullWhere**\n\n```dart\nfinal lastOrNull = [].lastOrNull; // null\n// or\nfinal lastOrNull = [3, 6, 2, 7, 9].lastOrNullWhere((item) =\u003e item \u003e 10); // null\n```\n\n* **singleOrNull** and **singleOrNullWhere**\n\n```dart\nfinal singleOrNull = [].singleOrNull; // null\n// or\nfinal singleOrNull = [3, 6, 2, 7, 9].singleOrNullWhere((item) =\u003e item \u003e 3); // null\n```\n\n* **mapList**\n\n```dart\nList\u003cdouble\u003e mappedList = [3, 6, 2, 7, 9].mapList((item) =\u003e item.toDouble());\n```\n\n* **whereList**\n\n```dart\nList\u003cint\u003e filteredList = [3, 6, 2, 7, 9].whereList((item) =\u003e item \u003e 4);\n```\n\n* **whereMapList**\n\n```dart\nList\u003cdouble\u003e filteredMappedList = [3, 6, 2, 7, 9].whereMapList((item) =\u003e item \u003e 4, (item) =\u003e item.toDouble());\n```\n\n* **mapWhereList**\n\n```dart\nList\u003cdouble\u003e mappedFilteredList = [3, 6, 2, 7, 9].mapWhereList((item) =\u003e item.toDouble(), (item) =\u003e item \u003e 4);\n```\n\n* **notNull**\n\n```dart\nIterable\u003cint\u003e notNullIterable = [3, 6, 2, null, 7, 9].notNull;\n```\n\n* **group**\n\n```dart\nfinal collection = [\n    Pet(\"rat\", \"Mike\"),\n    Pet(\"dog\", \"Rex\"),\n    Pet(\"cat\", \"Lucy\"),\n];\n\n/*\n\u003cbool, List\u003cPet\u003e\u003e{\n    true: [\n        Pet(\"rat\", \"Mike\"),\n        Pet(\"cat\", \"Lucy\"),\n    ],\n    false: [\n        Pet(\"dog\", \"Rex\"),\n    ],\n}\n*/\nfinal group = collection.group((item) =\u003e item.name.endsWith('at'));\n```\n\n* **groupMap**\n\n```dart\nfinal collection = [\n    Pet(\"rat\", \"Mike\"),\n    Pet(\"dog\", \"Rex\"),\n    Pet(\"cat\", \"Lucy\"),\n];\n\n/*\n\u003cbool, int\u003e{\n    true: 2,\n    false: 1,\n}\n*/\nfinal groupMapped = collection.groupMap(\n      (item) =\u003e item.name.endsWith('at'), (group) =\u003e group.length);\n```\n\n### Comparable\n\n* **min** and **minOrNull**\n\n```dart\nfinal min = [3, 6, 2, 7, 9].min; // 2\n// or\nfinal min = [].minOrNull; // null\n```\n\n* **minWhere** and **minOrNullWhere**\n\n```dart\nfinal min = [3, 6, 2, 7, 9].minWhere((_) =\u003e _ \u003e 4); // 6\n// or\nfinal min = [3, 2].minOrNullWhere((_) =\u003e _ \u003e 4); // null\n```\n\n* **max** and **maxOrNull**\n\n```dart\nfinal max = [3, 6, 2, 7, 9].max; // 9\n// or\nfinal max = [].maxOrNull; // null\n```\n\n* **maxWhere** and **maxOrNullWhere**\n\n```dart\nfinal max = [3, 6, 2, 7, 9].maxWhere((_) =\u003e _ \u003c 4); // 3\n// or\nfinal max = [3, 2].maxOrNullWhere((_) =\u003e _ \u003e 4); // null\n```\n\n### Math\n\n* **sum**\n\n```dart\nfinal sum = [3, 6, 2, 7, 9].sum; // 27\n```\n\n* **average**\n\n```dart\nfinal average = [1, 3, 5, 7, 4, 4].average; // 4\n```\n\n* **sumWhere**\n\n```dart\nfinal sum = [3, 6, 2, 7, 9].sumWhere((_) =\u003e _ \u003e 4); // 22\n```\n\n* **averageWhere**\n\n```dart\nfinal average = [1, 3, 5, 7, 4, 4].averageWhere((_) =\u003e _ \u003e 4); // 6\n```\n\n### Set\n\n* **distinct**\n\n```dart\nfinal collectionOne = [2, 5, 8, 2];\n\nfinal distinctCollection = collectionOne.distinct; // [2, 5, 8]\n```\n\n* **distinctWhere**\n\n```dart\nfinal collectionOne = [2, 5, 8, 2];\n\nfinal distinctCollection = collectionOne.distinctWhere((_) =\u003e _ \u003e 4); // [5, 8]\n```\n\n* **union**\n\n```dart\nfinal collectionOne = [2, 5, 8, 2];\nfinal collectionTwo = [1, 3, 5, 7];\n\nfinal unitedCollection = collectionOne.union(collectionTwo); // [2, 5, 8, 1, 3, 7]\n```\n\n* **unionWhere**\n\n```dart\nfinal collectionOne = [2, 5, 8, 2];\nfinal collectionTwo = [1, 3, 5, 7];\n\nfinal unitedCollection = collectionOne.unionWhere(collectionTwo, (_) =\u003e _ \u003e 4); // [5, 8, 7]\n```\n\n* **intersection**\n\n```dart\nfinal collectionOne = [2, 5, 8, 2];\nfinal collectionTwo = [1, 3, 5, 7];\n\nfinal intersectedCollection = collectionOne.intersection(collectionTwo); // [5]\n```\n\n* **intersectionWhere**\n\n```dart\nfinal collectionOne = [2, 5, 8, 2];\nfinal collectionTwo = [1, 3, 5, 7];\n\nfinal intersectedCollection = collectionOne.intersectionWhere(collectionTwo, (_) =\u003e _ \u003c 4); // []\n```\n\n* **difference**\n\n```dart\nfinal collectionOne = [2, 5, 8, 2];\nfinal collectionTwo = [1, 3, 5, 7];\n\nfinal differedCollection = collectionOne.difference(collectionTwo); // [2, 8]\n// or\nfinal differedCollection = collectionTwo.difference(collectionOne); // [1, 3, 7]\n```\n\n* **differenceWhere**\n\n```dart\nfinal collectionOne = [2, 5, 8, 2];\nfinal collectionTwo = [1, 3, 5, 7];\n\nfinal differedCollection = collectionOne.differenceWhere(collectionTwo, (_) =\u003e _ \u003c 4); // [2]\n// or\nfinal differedCollection = collectionTwo.differenceWhere(collectionOne, (_) =\u003e _ \u003c 4); // [1, 3]\n```\n\n## Feature requests and Bug reports\n\nFeel free to post a feature requests or report a bug [here](https://github.com/marchdev-tk/flinq/issues).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarchdev-tk%2Fflinq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarchdev-tk%2Fflinq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarchdev-tk%2Fflinq/lists"}