{"id":19346291,"url":"https://github.com/pacifio/byte_flow","last_synced_at":"2025-04-23T04:36:49.042Z","repository":{"id":56826848,"uuid":"288941703","full_name":"pacifio/byte_flow","owner":"pacifio","description":"Byte flow is a pure dart , dependency less library that provides common utility functions for lists and strings .","archived":false,"fork":false,"pushed_at":"2021-08-05T01:59:41.000Z","size":6565,"stargazers_count":17,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T08:23:34.519Z","etag":null,"topics":["array","array-manipulations","dart","dart-library","flutter-library","fluttter","list","lodash","utility"],"latest_commit_sha":null,"homepage":"https://pub.dev/documentation/byte_flow/latest/","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pacifio.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}},"created_at":"2020-08-20T07:48:56.000Z","updated_at":"2023-12-05T06:23:29.000Z","dependencies_parsed_at":"2022-09-20T22:11:12.452Z","dependency_job_id":null,"html_url":"https://github.com/pacifio/byte_flow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifio%2Fbyte_flow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifio%2Fbyte_flow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifio%2Fbyte_flow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacifio%2Fbyte_flow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pacifio","download_url":"https://codeload.github.com/pacifio/byte_flow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250372529,"owners_count":21419719,"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":["array","array-manipulations","dart","dart-library","flutter-library","fluttter","list","lodash","utility"],"created_at":"2024-11-10T04:09:33.132Z","updated_at":"2025-04-23T04:36:48.130Z","avatar_url":"https://github.com/pacifio.png","language":"Dart","readme":"# Byte flow\n\n[![Build Status](https://travis-ci.org/pacifio/byte_flow.svg?branch=master)](https://travis-ci.org/pacifio/byte_flow)\n\nByte flow is a pure dart , dependency less library that provides common utility functions for lists and strings .\n\n## Contents\n\n- [Install](#install)\n- [Functions](#functions)\n- [Array](#array)\n- [String](#string)\n- [TODO](#todo)\n\n## Install\n\n```yaml\ndependencies:\n  byte_flow: ^1.0.0\n```\n\nAfter this run `flutter pub get`\nThen import the library\n\n```dart\nimport 'package:byte_flow/byte_flow.dart';\n```\n\n## Functions\n\nByte flow contains helpful utility functions for lists and strings but it's main target is to provide developers rich set of list utilites .\n\n## Array\n\nFirst import the library like this\n\n```dart\nimport 'package:byte_flow/byte_flow.dart' as _;\n```\n\n---\n\n### `_.chunk(List list, [int size = 1])`\n\nCreates an list of elements split into groups the length of `size`. If `list` can't be split evenly, the final chunk will be the remaining elements.\n\nExample\n\n```dart\n_.chunk(['a', 'b', 'c', 'd'], 2);\n// Returns ['a', 'b'],['c', 'd']\n\n_.chunk(['a', 'b', 'c', 'd'], 3)\n// Returns ['a', 'b', 'c'],['d']\n```\n\n---\n\n### `_.slice(List list, [int start = 0, int end])`\n\nCreates a slice of `list` from `start` up to, but not including, `end`.\n\nExample\n\n```dart\n_.slice([1, 2, 3, 4], 2);\n// Returns [3, 4]\n```\n\n---\n\n### `_.compact(List list)`\n\nCreates an list with all falsey values removed. The values `false`, `null`,`0`, `\"\"`, and `NaN` are falsey.\n\nExample\n\n```dart\n_.compact([0, 1, false, 2, '', 3]);\n// Returns [1, 2, 3]\n\n_.compact([1, 2, 'some data', 2, '', 3, false, null]);\n// Returns [1, 2, 'some data', 2, 3]\n```\n\n---\n\n### `_.drop(List list, [int n = 1])`\n\nCreates a slice of `list` with `n` elements dropped from the beginning.\n\nExample\n\n```dart\n_.drop([1, 2, 3]);\n// Returns [2,3]\n\n_.drop([1, 2, 3], 2);\n// Returns [3]\n\n_.drop([1, 2, 3], 5);\n// Returns []\n\n_.drop([1, 2, 3], 0);\n// Returns [1, 2, 3]\n```\n\n---\n\n### `_.dropRight(List list, [int n = 1])`\n\nCreates a slice of `list` with `n` elements dropRightped from the beginning.\n\nExample\n\n```dart\n_.dropRight([1, 2, 3])\n// Returns [1,2]\n_.dropRight([1, 2, 3], 2)\n// Returns [1]\n_.dropRight([1, 2, 3], 5)\n// Returns []\n_.dropRight([1, 2, 3], 0)\n// Returns [1, 2, 3]\n```\n\n---\n\n### `_.fill(List list, dynamic value, [int start = 0, int end])`\n\nFills elements of `list` with `value` from `start` up to, but not including, `end`.\n\nExample\n\n```dart\n_.fill(List(3), 4);\n// Returns [4, 4, 4]\n```\n\n---\n\n### `_.findIndex(List list, dynamic element)`\n\nThis method uses dart's default `List.indexOf()`\n\nExample\n\n```dart\n_.findIndex([\"Jack\", \"Yash\", \"Adib\", \"Alex\"], \"Adib\");\n// Returns 2\n```\n\n---\n\n### `_.findLastIndex(List list, dynamic element)`\n\nThis method finds the item in the list from right / last using dart's `List.indexOf()` method\n\nExample\n\n```dart\n_.findLastIndex([\"Jack\", \"Yash\", \"Adib\", \"Adib\"], \"Adib\");\n// Returns 0\n```\n\n---\n\n### `_.head(List list)`\n\nFinds the first element in the list Uses dart's `List.first` property\n\nExample\n\n```dart\n_.head([\"Dart\", \"Javascript\", \"Swift\"]);\n// Returns \"Dart\"\n```\n\n---\n\n### `_.flatten(List list)`\n\nFlatten a list , Credit goes to [Justin Fagnani](https://stackoverflow.com/users/192153/justin-fagnani)\n\nExample\n\n```dart\n_.flatten([\n  [1, 2, 3],\n  ['a', 'b', 'c'],\n  [true, false, true]\n]);\n// Returns [1, 2, 3, 'a', 'b', 'c', true, false, true]\n```\n\n---\n\n### `_.pairs(List pairs)`\n\nThis method returns an `map` composed from key-value `pairs`.\n\nExample\n\n```dart\n_.pairs([\n  ['a', 1],\n  ['b', 2]\n]);\n// Returns {'a': 1, 'b': 2}\n```\n\n---\n\n### `\\_.initial(List list)```\n\nGets all but the last element of list.\n\nExample\n\n```dart\n_.initial([1, 2, 3]);\n// Returns [1, 2]\n\n_.initial([1, 2, 3, 'a', 'b', 'c']);\n// Returns [1, 2, 3, 'a', 'b']\n```\n\n---\n\n### `_.map(List list, Function(dynamic element, int index, List list) iteratee)`\n\nCreates an list of values by running each element of `list` thru `iteratee`. The iteratee is invoked with three arguments: (value, index, list).\n\nExample\n\n```dart\nsquare(n, index, list) {\n  return n*n;\n}\n_.map([4, 8], square);\n// Returns [16, 64]\n\n_.map([4, 8], (n, index, list) {\n  return n * 0;\n});\n// Returns [0, 0]\n```\n\n---\n\n### `_.intersect(List\u003cList\u003e arrays)`\n\nCreates an list of unique values that are included in all given arrays\n\nExample\n\n```dart\nfinal lists = [\n  [1, 2, 3],\n  [2, 4, 5],\n  [2, 8, 9]\n];\n_.intersect(lists);\n// Returns [2]\n```\n\n---\n\n### `_.join(List list, [String separator = ','])`\n\nConverts all elements in list into a string separated by separator. Uses dart's `List.join()`\n\nExample\n\n```dart\n_.join(['a', 'b', 'c'], '~');\n// Returns 'a~b~c'\n```\n\n---\n\n### `_.last(List list)`\n\nGets the last element of list. Uses dart's `List.last` property\n\nExample\n\n```dart\n_.last([\"Dart\", \"Javascript\", \"Swift\"]);\n// Returns \"Swift\"\n```\n\n---\n\n### `_.nth(List list, int n)`\n\nGets the element at index `n` of `list`. If `n` is negative, the nth element from the end is returned.\n\nExample\n\n```dart\n_.nth(['a', 'b', 'c', 'd'], 2);\n// Returns 'c'\n\n_.nth(['a', 'b', 'c', 'd'], -1);\n// Returns 'd'\n```\n\n---\n\n### `_.sortedIndex(List list, dynamic value)`\n\nUses a binary search to determine the lowest index at which value should be inserted into list in order to maintain its sort order. Returns the index at which value should be inserted into list.\n\nExample\n\n```dart\n_.sortedIndex([30, 50], 60);\n// Returns 2\n\n_.sortedIndex([30, 50], 40);\n// Returns 1\n\n_.sortedIndex([30, 50], 30);\n// Returns 0\n```\n\n---\n\n### `_.tail(List list)`\n\nGets all but the first element of list.\n\nExample\n\n```dart\n_.tail([1, 2, 3]);\n// Returns [2, 3]\n```\n\n---\n\n### `_.take(List list, [int n = 1])`\n\nCreates a slice of list with n elements taken from the beginning. Uses dart's native `List.take(n)` method\n\nExample\n\n```dart\n_.take([1, 2, 3], 2);\n// Returns [1, 2]\n```\n\n---\n\n### `_.takeRight(List list, [int n = 1])`\n\nCreates a slice of list with n elements taken from the end.\n\nExample\n\n```dart\ntakeRight([1, 2, 3])\n// =\u003e [3]\ntakeRight([1, 2, 3], 2)\n// =\u003e [2, 3]\ntakeRight([1, 2, 3], 5)\n// =\u003e [1, 2, 3]\ntakeRight([1, 2, 3], 0)\n// =\u003e []\n```\n\n---\n\n### `_.union(List\u003cList\u003e arrays)`\n\nCreates an list of unique values, in order\n\nExample\n\n```dart\n_.union([\n  [2],\n  [1, 2]\n]);\n\n// Returns [2, 1]\n```\n\n---\n\n### `_.unzip(List list)`\n\nThis method Returns the new list of regrouped elements\n\nExample\n\n```dart\n_.unzip([['a', 1, true], ['b', 2, false]]);\n// Returns [['a', 'b'], [1, 2], [true, false]]\n```\n\n---\n\n### `_.zip(List a, List b)`\n\nZips two arrays , [Credit](https://stackoverflow.com/questions/22015684/how-do-i-zip-two-arrays-in-javascript)\n\nExample\n\n```dart\n_.zip(['a', 'b', 'c'], [1, 2, 3]);\n// Returns [['a', 1],['b', 2],['c', 3]]\n```\n\n---\n\n### `_.duplicate(List list)`\n\nFind duplicate items in an list .\n\nExample\n\n```dart\n_.duplicate([10, 12, 9, 21, 1, 2, 10]);\n// Returns [10]\n```\n\n## String\n\nByte flow libraries string utility collection is poor but still under development . The following functions are stable\n\n### `_.capitalize(String text)`\n\nCapitalizes the given string\n\nExample\n\n```dart\n_.capitalize(\"hello world !\");\n// Returns \"Hello world !\"\n```\n\n## TODO\n\n- [x] Null safety\n- [ ] Extension support\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacifio%2Fbyte_flow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpacifio%2Fbyte_flow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacifio%2Fbyte_flow/lists"}