{"id":15008496,"url":"https://github.com/madsimple/heart","last_synced_at":"2026-03-14T16:15:33.342Z","repository":{"id":242412146,"uuid":"809196262","full_name":"MadSimple/heart","owner":"MadSimple","description":"Dart extension methods for strings and lists, inspired by Haskell","archived":false,"fork":false,"pushed_at":"2024-06-30T03:34:16.000Z","size":259,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T22:47:21.319Z","etag":null,"topics":["dart","dart-lang","dartpackage","flutter","flutter-apps","haskell","string-manipulation"],"latest_commit_sha":null,"homepage":"","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/MadSimple.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":"2024-06-02T01:35:35.000Z","updated_at":"2024-12-29T04:20:46.000Z","dependencies_parsed_at":"2024-10-23T00:36:16.747Z","dependency_job_id":null,"html_url":"https://github.com/MadSimple/heart","commit_stats":null,"previous_names":["madsimple/heart"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadSimple%2Fheart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadSimple%2Fheart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadSimple%2Fheart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MadSimple%2Fheart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MadSimple","download_url":"https://codeload.github.com/MadSimple/heart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243190962,"owners_count":20250985,"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":["dart","dart-lang","dartpackage","flutter","flutter-apps","haskell","string-manipulation"],"created_at":"2024-09-24T19:19:07.525Z","updated_at":"2025-12-25T17:48:17.614Z","avatar_url":"https://github.com/MadSimple.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Heart\r\n\r\n\r\nExtension methods for strings and lists, inspired by Haskell.\r\n###\r\nAlphabetical list of features: [after](#before-after), [any](#any-every), [ascending](#ascending-descending), [average](#sum-product-average),\r\n[backwards](#backwards), [before](#before-after),\r\n[chr](#chr-chrs), [chrs](#chr-chrs), [concat](#concat),\r\n[count](#count), [deepContains](#deepequals-deepcontains), [deepEquals](#deepequals-deepcontains),\r\n[descending](#ascending-descending),\r\n[drop](#drop-dropwhile), [dropWhile](#drop-dropwhile), [every](#any-every),\r\n[filter](#filter), [group](#group-groupby), [groupBy](#group-groupby),\r\n[head](#head-tails-last-inits), [inclusive](#range-inclusive), [inclusiveString](#rangestring-inclusivestring), [indices](#indices),\r\n[inits](#head-tails-last-inits), [insertInOrder](#insertinorder),\r\n[intercalate](#intercalate-in-ter-kuh-late), [interleave](#interleave), [intersect](#union-intersect), [intersperse](#intersperse),\r\n[isLowerCase](#isuppercase-islowercase), [isUpperCase](#isuppercase-islowercase),\r\n[last](#head-tails-last-inits), [letterCount](#words-wordcount-letters-lettercount),\r\n[letters](#words-wordcount-letters-lettercount),\r\n[nub](#nub), [product](#sum-product-average), [range](#range-inclusive), [rangeString](#rangestring-inclusivestring),\r\n [removeWhitespace](#removewhitespace),\r\n[replace](#replace), [riffleIn](#rifflein-riffleout), [riffleOut](#rifflein-riffleout), [shuffled](#shuffled), [splitAt](#splitat), [startsWith](#startswith),\r\n[subtract](#subtract-subtractall), [subtractAll](#subtract-subtractall), [sum](#sum-product-average),\r\n[tail](#head-tails-last-inits), [tails](#head-tails-last-inits), [toStringList](#tostringlist),\r\n[union](#union-intersect), [unwords](#unwords), [wordCount](#words-wordcount-letters-lettercount),\r\n[words](#words-wordcount-letters-lettercount),\r\n[zip](#zip-zip2), [zip2](#zip-zip2), [zip3](#zip-zip2), [zip4](#zip-zip2), [\u003e, \u003e=, \u003c, \u003c=, ^, *](#operators-for-strings-and-lists)\r\n\r\n#### deepEquals, deepContains\r\n\r\nThis package uses Dart's ```DeepCollectionEquality``` from [collection](https://pub.dev/packages/collection) whenever posssible, so ```deepEquals([1, 2], [1, 2])``` returns true, even though ```[1, 2] == [1, 2]``` is normally false. ```[{1: 2}, {2: 3}].deepContains({2: 3})``` is also true.\r\n#\r\n\r\n#### (Strings are treated as lists in Haskell, and have many of the same functions.)\r\n\r\n## ascending, descending\r\nSort lists and strings:\r\n```dart\r\nList\u003cint\u003e l = [4, 5, 1, 2, 3].ascending(); // [1, 2, 3, 4, 5]\r\nList\u003cint\u003e l2 = [4, 5, 1, 2, 3].descending(); // [5, 4, 3, 2, 1]\r\n\r\nString s = 'hello'.ascending(); // 'ehllo'\r\nString s = 'hello'.descending(); // 'ollhe'\r\n```\r\n\r\n## before, after\r\nGet everything before or after a sublist:\r\n```dart\r\nList\u003cint\u003e? l = [1, 2, 3, 3].before([3]); // [1, 2]\r\n[1, 2, 3, 3].before([2, 3]) // [1]\r\n\r\n[1, 2, 3, 3].after([2, 3]) // [3]\r\n```\r\nOptional skip parameter skips that many occurrences:\r\n```dart\r\n[1, 2, 3, 3].before([3], skip: 1) // [1, 2, 3]\r\n[1, 2, 3, 3].after([3], skip: 1) // []\r\n```\r\nReturns null if doesn't contain sublist:\r\n```dart\r\n[1, 2, 3, 3].before([4, 5]) // null\r\n```\r\n\r\n## startsWith\r\nDart already has this for strings.\r\n```dart\r\nbool b = [1, 2, 3].startsWith([1, 2]); // true\r\n```\r\n## nub\r\nRemove duplicates:\r\n```dart\r\nList\u003cint\u003e l = [1, 2, 1, 2].nub() // [1, 2]\r\nString s = 'hello'.nub(); // 'helo'\r\n```\r\nOptional list or string parameter only looks at those elements:\r\n```dart\r\n[1, 1, 2, 2, 3, 3].nub([1, 2]) // [1, 2, 3, 3]\r\n'aaabbbcc'.nub('ab') // 'abcc'\r\n```\r\n\r\n## backwards\r\nReverse a string or list:\r\n```dart\r\nList\u003cint\u003e l = [1, 2, 3].backwards(); // [3, 2, 1]\r\nString s = 'hello'.backwards(); // 'olleh'\r\n```\r\n\r\n## shuffled\r\nReturns a shuffled list or string.\r\n(Dart's ```shuffle``` method is void)\r\n\r\n```dart\r\nList\u003cint\u003e l = [1, 2, 3, 4, 5].shuffled();\r\n// Specify a Random object:\r\nList\u003cint\u003e l = [1, 2, 3, 4, 5].shuffled(Random.secure());\r\n\r\nString s = 'hello'.shuffled();\r\n```\r\n\r\n## sum, product, average\r\nAdd or multiply numbers in a list:\r\n```dart\r\nint s = [1, 2, 3].sum(); // 6\r\nint p = [4, 5, 6].product(); // 120\r\ndouble a = [11, 2, 33, 55, 7, 2, 1].average(); // 15.857142857142858\r\n\r\n// .average() works for Strings based on character codes\r\n'abc'.average() // 'b'\r\n```\r\n\r\n## count\r\nCount occurrences in a list or string:\r\n```dart\r\nint c = [1, 2, 1, 3].count(1); // 2\r\n// Note: '.indices([1]).length' gives same result, and can be used for sublists instead of one element\r\n\r\n[{1,2}, [1,3]].count({1,2}) // 1\r\n\r\n'hello world'.count('l') // 3\r\n'hello world'.count('ll') // 1\r\n```\r\n\r\n## indices\r\nFind where sublist occurs in a list, or substring occurs in a string:\r\n```dart\r\nList\u003cint\u003e l = [1, 2, 1, 2, 1].indices([1]); // [0, 2, 4]\r\n[1, 2, 1, 2, 1].indices([1, 2]) // [0, 2]\r\n\r\n'hello'.indices('ll') // [2]\r\n\r\n[[1,2], [1,2], {3: 4}].indices([[1, 2], {3: 4}]) // [1]\r\n```\r\nOptional ```exclusive``` parameter means the sublists at the result indices would be mutually exclusive:\r\n```dart\r\n[1, 1, 1, 1].indices([1, 1]) // [0, 1, 2]\r\n[1, 1, 1, 1].indices([1, 1], exclusive: true) // [0, 2]\r\n'aaaa'.indices('aa', exclusive: true) // [0, 2]\r\n```\r\n\r\n## concat\r\nConcatenate nested lists or strings:\r\n```dart\r\nList\u003cint\u003e l = [[1, 2], [3, 4], [5, 6]].concat(); // [1, 2, 3, 4, 5, 6]\r\nString str = ['hello', 'world'].concat(); // 'helloworld'\r\n```\r\n\r\n## intersperse\r\nInserts an item in between all other elements:\r\n```dart\r\nList\u003cint\u003e l = [1, 2, 3].intersperse(0); // [1, 0, 2, 0, 3]\r\nString s = 'hello'.intersperse('-'); // 'h-e-l-l-o'\r\n// Note: 'replace' method with empty list or string adds element to beginning and end\r\n'hello'.replace('', '-') // '-h-e-l-l-o-'\r\n\r\n```\r\n\r\n## intercalate (in-TER-kuh-late)\r\n\r\nInserts a list between lists (or string between strings) and concatenates the result:\r\n```dart\r\nList\u003cint\u003e l = [[1, 2], [3, 4], [5, 6]].intercalate([0, 0]);\r\n// [1, 2, 0, 0, 3, 4, 0, 0, 5, 6]\r\n\r\nString s = ['hello', 'world'].intercalate('-');\r\n// 'hello-world'\r\n```\r\nOptional ```count``` parameter only adds that many times:\r\n```dart\r\n[[1, 2], [3, 4], [5, 6]].intercalate([0, 0], count: 1) // [1, 2, 0, 0, 3, 4, 5, 6]\r\n```\r\n\r\n## filter\r\nKeep only elements that meet criteria:\r\n```dart\r\n// Keep where x^3 \u003c 10:\r\nList\u003cint\u003e l = [1, 2, 3, 4].filter((x) =\u003e pow(x, 3) \u003c 10); // [1, 2]\r\n```\r\nEquivalent to ```.where().toList()```, but also works on Strings:\r\n```dart\r\n// '\u003c' operator defined in this package\r\nString s = 'hello world'.filter((char) =\u003e char \u003c 'j'); // 'he d'\r\n```\r\n\r\n## any, every\r\n(These already exist for lists)\r\n```dart\r\nbool b = 'hello'.any((char) =\u003e char == 'h'); // true\r\nbool b2 = 'hello'.every((char) =\u003e char == 'h'); // false\r\n```\r\n## drop, dropWhile\r\n```drop(n)``` removes first n elements. Similar to ```.sublist(n)``` or ```.substring(n)``` but doesn't throw exception for invalid n.\r\n```dart\r\nList\u003cint\u003e l = [0, 1, 2].drop(1); // [1, 2]\r\n\r\n// Returns the same if n\u003c=0\r\n[0, 1, 2].drop(-1) // [0, 1, 2]\r\n// Returns empty if n \u003e= length\r\n[0, 1, 2].drop(100) // []\r\n\r\n'hello'.drop(2)\r\n// 'llo'\r\n```\r\n```dropWhile``` drops elements until they don't meet criteria, keeps everything after.\r\n```dart\r\nList\u003cint\u003e l = [1, 2, 3, 2, 1].dropWhile((x) =\u003e x \u003c 3);\r\n// [3, 2, 1]\r\n\r\n// '\u003c' operator defined in this package\r\nString s = 'hello'.dropWhile((char) =\u003e char \u003c 'i');\r\n// 'llo'\r\n```\r\n\r\n## replace\r\nRemove all occurrences or replace with a particular sublist:\r\n```dart\r\nList\u003cint\u003e l = [1, 1, 2, 3].replace([1]); // [2, 3]\r\n[1, 1, 2, 3].replace([1, 1], [99]) // [99, 2, 3]\r\n\r\n'aaaa'.replace('a', 'b') // 'bbbb'\r\n```\r\nOptional third parameter only replaces that many occurrences:\r\n```dart\r\n[1, 1, 1, 1].replace([1], [3, 4], 2) // [3, 4, 3, 4, 1, 1]\r\n'aaaa'.replace('a', 'bc', 2) // 'bcbcaa'\r\n```\r\n\r\n##  subtract, subtractAll\r\n```subtract``` removes elements one at a time (like Haskell's \\\\\\\\):\r\n```dart\r\nList\u003cint\u003e l = [1, 1, 2, 2, 3].subtract([1, 3]); // [1, 2, 2]\r\n\r\nl = [1, 1, 2, 2].subtract([1, 2, 3]); // [1, 2]\r\n// ignores 3 since it is not in original list\r\n\r\nString s = 'hello'.subtract('eo'); // 'hll'\r\n```\r\n```subtractAll``` removes all occurrences:\r\n```dart\r\nList\u003cint\u003e l = [1, 1, 2, 2].subtractAll([1]); // [2, 2]\r\nString s = 'hello'.subtractAll('lo'); // 'he'\r\n```\r\n## union, intersect\r\n```union``` adds elements that aren't already present.\r\n\r\nIt doesn't remove duplicates from original, but doesn't add duplicates from input.\r\n\r\n```dart\r\nList\u003cint\u003e l = [1, 1, 2, 3].union([2, 3, 4, 4]); // [1, 1, 2, 3, 4]\r\nString s = 'hello'.union(' world'); // 'hello wrd'\r\n```\r\n(Use ```.nub()``` to remove duplicates, and concatenate normally to keep duplicates.)\r\n\r\n```intersect``` keeps all elements from original list that are also in input.\r\n```dart\r\nList\u003cint\u003e l = [1, 1, 2, 3].intersect([1, 2]); // [1, 1, 2]\r\nString s = 'hello'.intersect('world'); // 'llo'\r\n// Remove duplicates with .nub()\r\n```\r\n\r\n\r\n## head, tail(s), last, inits,\r\n```head``` returns first element.\r\n\r\n```tail``` returns everything but the first element.\r\n\r\n```last``` returns the last element (Dart has this for lists but not strings).\r\n\r\n```dart\r\nint? i = [1, 2, 3].head(); // 1\r\nList\u003cint\u003e? l = [1, 2, 3].tail(); // [2, 3]\r\n[1].tail() // []\r\n[].tail() // null\r\n\r\n'hello'.head() // 'h'\r\n'hello'.tail() // 'ello'\r\n'hello'.last() //'o'\r\n```\r\n```inits```\r\nreturns a list of lists (or strings) by adding elements from the beginning:\r\n```dart\r\n[1, 2, 3].inits()\r\n// [[], [1], [1, 2], [1, 2, 3]]\r\n\r\n'hi'.inits()\r\n// ['', 'h', 'hi']\r\n```\r\n```tails``` returns a list of lists (or strings) by removing one element at a time from the beginning:\r\n```dart\r\n[1, 2, 3].tails()\r\n// [[1, 2, 3], [2, 3], [3], []]\r\n\r\n// inclusive function defined in this package\r\nList\u003cList\u003cint\u003e\u003e twelveDaysOfChristmas = inclusive(12, 1).tails().backwards();\r\n// [[], [1], [2, 1], [3, 2, 1], [4, 3, 2, 1], [5, 4, 3, 2, 1], [6, 5, 4, 3, 2, 1], [7, 6, 5, 4, 3, 2, 1], [8, 7, 6, 5, 4, 3, 2, 1], [9, 8, 7, 6, 5, 4, 3, 2, 1], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]]\r\n\r\n'hello'.tails()\r\n// ['hello', 'ello', 'llo', 'lo', 'o', '']\r\n```\r\n## insertInOrder\r\nInserts a value before the first element that is \u003e=. Does not sort.\r\n```dart\r\nList\u003cdouble\u003e l2 = [1.1, 2.2, 0.2].insertInOrder(1.7);\r\n// [1.1, 1.7, 2.2, 0.2]\r\n\r\nString s = 'ABDKEO'.insertInOrder('J'); // 'ABDJKEO'\r\n\r\n```\r\n## splitAt\r\nSplit a list or string into two:\r\n```dart\r\nList\u003cList\u003cint\u003e\u003e l = [5, 6, 7, 8].splitAt(2); // [[5, 6], [7, 8]]\r\n\r\n'hello'.splitAt(2) // ['he', 'llo'] \r\n```\r\n\r\n## interleave\r\nCombine two lists or strings by taking turns:\r\n```dart \r\nList\u003cint\u003e l = [1, 2, 3].interleave([4, 5, 6]);\r\n// [1, 4, 2, 5, 3, 6]\r\n\r\n'abc'.interleave('123')\r\n// 'a1b2c3'\r\n```\r\nExtra characters get added to the end:\r\n```dart\r\n[1, 2, 3, 4].interleave([5])\r\n// [1, 5, 2, 3, 4]\r\n```\r\n\r\n## riffleIn, riffleOut\r\nRiffle shuffle: splits list or string in half and interleaves them\r\n\r\n![image](https://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Faro_shuffles.svg/250px-Faro_shuffles.svg.png)\r\n```dart\r\n// .riffleOut interleaves first half to second.\r\nList\u003cint\u003e l = [1, 2, 3, 4, 5, 6].riffleOut();\r\n// [1, 4, 2, 5, 3, 6]\r\n\r\n// .riffleIn interleaves second half to first\r\nList\u003cint\u003e l2 = [1, 2, 3, 4, 5, 6].riffleIn();\r\n// [4, 1, 5, 2, 6, 3]\r\n\r\nString s = '12345'.riffleOut();\r\n// '14253'\r\nString s2 = '12345'.riffleIn();\r\n// '31425'\r\n```\r\n## group, groupBy\r\n```group``` combines consecutive elements together if they are equal:\r\n```dart\r\nList\u003cList\u003cint\u003e\u003e l = [1, 2, 3, 3, 1].group();\r\n// [[1], [2], [3, 3], [1]]\r\n\r\nList\u003cString\u003e ls = 'hello'.group();\r\n// ['h', 'e', 'll', 'o']\r\n```\r\n```groupBy``` combines consecutive elements if they meet criteria.\r\nIn this example, items are in the same sublist if they are less than the one after:\r\n```dart\r\nList\u003cList\u003cint\u003e\u003e l = [1, 2, 3, 2, 1].groupBy((a, b) =\u003e a \u003c b);\r\n// [[1, 2, 3], [2], [1]]\r\n```\r\n\r\n```dart\r\nList\u003cString\u003e ls = 'HelLo'.groupBy((a, b) =\u003e a.isUpperCase() \u0026\u0026 b.isLowerCase());\r\n// ['He', 'l', 'Lo']\r\n```\r\n\r\n\r\n## chr, chrs\r\n\r\n```chr``` returns a String from a character code.\r\n\r\n```chrs``` returns a String from a list of codes.\r\n\r\n```dart\r\n97.chr() // 'a'\r\n[97, 98].chrs() // 'ab'\r\n\r\n// .codeUnits converts back to codes\r\n```\r\n\r\n\r\n\r\n\r\n# Other methods for lists\r\n\r\n\r\n\r\n\r\n\r\n## toStringList\r\nConvert all elements to strings:\r\n```dart\r\nList\u003cString\u003e l = [1, 2, 3].toStringList(); // ['1', '2', '3']\r\n```\r\n\r\n\r\n## zip, zip2\r\n```zip``` takes in a list of lists, returns a list of lists where corresponding elements are paired together.\r\n```dart\r\nList l = zip([['one','two','three'], [1,2,3]]);\r\n// [['one', 1], ['two', 2], ['three', 3]]\r\n```\r\n```zip2``` takes in a list of 2 lists and performs a function between corresponding elements (similar to Haskell's zipWith):\r\n```dart\r\nList l = zip2([[1,2,3],[4,5,6]], (a,b) =\u003e a+b); // [5, 7, 9]\r\n```\r\n```zip3``` and ```zip4``` work similarly.\r\n\r\n\r\n\r\n\r\n\r\n\r\n# Other methods for Strings\r\n\r\n\r\n\r\n\r\n\r\n## removeWhitespace\r\n```dart\r\nString s = '  hello \\n world  '.removeWhitespace(); // 'helloworld'\r\n\r\n// Dart's .trim() only removes leading and trailing whitespace.\r\n```\r\n\r\n\r\n## words, wordCount, letters, letterCount\r\n```words``` returns a list of words without whitespace.\r\n\r\n```wordCount``` takes the length of this List. Equivalent to ```words().length```.\r\n\r\n```dart\r\nList\u003cString\u003e listOfWords = 'hello world'.words(); // ['hello', 'world']\r\nint w = 'hello world'.wordCount(); // 2\r\n```\r\n\r\n```letters``` returns a List of all the characters, with optional ```keepWhitespace``` parameter.\r\n\r\n```letterCount``` counts all characters, with optional ```keepWhitespace``` parameter.\r\n```dart\r\nList\u003cString\u003e listOfCharacters = 'hello world'.letters();\r\n// ['h', 'e', 'l', 'l', 'o', 'w', 'o', 'r', 'l', 'd']\r\n\r\nint lc = 'hello world'.letterCount();\r\n// 10\r\n```\r\n```dart\r\n'hello world'.letters(keepWhitespace: true)\r\n// ['h', 'e', 'l', 'l', ' ', 'o', 'w', 'o', 'r', 'l', 'd']\r\n\r\n'hello world'.letterCount(keepWhitespace: true)\r\n// 11 (same as .length)\r\n```\r\n\r\n## unwords\r\nCombine a list of strings into one, with spaces in between:\r\n```dart\r\nString s = ['hello', 'world'].unwords(); // 'hello world'\r\nString s2 = 'hello world'.letters().unwords(); 'h e l l o w o r l d'\r\n```\r\n\r\n## isUpperCase, isLowerCase\r\nChecks if all characters are upper or lower case, with optional ```ignoreSymbols``` parameter.\r\n\r\n```dart\r\nbool b = 'hello world'.isLowerCase(); // true\r\nbool b2 = 'hello world'.isLowerCase(ignoreSymbols: false); // false (because of space)\r\n\r\nbool b3 = 'Hello'.isUpperCase(); // false\r\nbool b4 = 'Hello'.isLowerCase(); // false\r\n\r\nbool b5 = 'á'.isLowerCase(ignoreSymbols: false); // true\r\n// accented letters don't count as symbols\r\n```\r\n\r\n\r\n\r\n\r\n\r\n# Other features\r\n\r\n\r\n\r\n\r\n\r\n\r\n## range, inclusive\r\nGenerates a list of integers:\r\n\r\n\r\n```dart\r\n// \"for(int i in range(5))\" is the same as \"for(int i = 0; i \u003c 5; i++)\"\r\n\r\nList\u003cint\u003e l = range(5); // [0, 1, 2, 3, 4]\r\ninclusive(5) // [0, 1, 2, 3, 4, 5]\r\n\r\nrange(-5) // [-4, -3, -2, -1, 0]\r\ninclusive(-5) // [-5, -4, -3, -2, -1, 0]\r\nrange(0) // []\r\ninclusive(0) // [0]\r\n```\r\n\r\nWith two arguments, ```inclusive``` includes the second one, ```range``` does not .\r\n\r\n```dart\r\nrange(1, 5) // [1, 2, 3, 4]\r\ninclusive(1, 5) // [1, 2, 3, 4, 5]\r\nrange(1, -2) // [1, 0, -1]\r\ninclusive(1, -2) // [1, 0, -1, -2]\r\n```\r\nThird argument adds a step count: \r\n```dart\r\nrange(1, 5, 2) // [1, 3]\r\ninclusive(1, 5, 2) // [1, 3, 5]\r\nrange(1, -5, -2) // [1, -1, -3]\r\ninclusive(1, -5, -2) // [1, -1, -3, -5]\r\n```\r\n\r\n## rangeString, inclusiveString\r\nSimilar to ```range``` and ```inclusive```. Strings must have exactly one character:\r\n```dart\r\nrangeString('a', 'f') // 'abcde'\r\nrangeString('c', 'a') // 'cb'\r\nrangeString('a', 'g', 2) // 'ace'\r\n\r\ninclusiveString('a', 'c') // 'abc'\r\ninclusiveString('c', 'a') // 'cba'\r\ninclusiveString('a', 'g', 2) // 'aceg'\r\n```\r\n\r\n## Operators for strings and lists\r\n### \u003e, \u003e=, \u003c, \u003c=\r\n\r\nCompare elements in two lists, starting at the beginning:\r\n```dart\r\n[1, 2, 3] \u003e [1, 1, 3] // true\r\n```\r\nCompare strings according to their character codes:\r\n```dart\r\n'b' \u003e 'a' // true\r\n'hello' \u003c 'hi' // true\r\n\r\n['a', 1] \u003e= ['b', 1] // false\r\n```\r\n(If elements cannot be compared, both \u003e= and \u003c= will return false.)\r\n\r\n### ^\r\nGet next String by character codes:\r\n```dart\r\nString s = 'a' ^ 1; // 'b'\r\n'b' ^ (-1) // 'a'\r\n'abc' ^ 1 // 'bcd\r\n```\r\n### *\r\nRepeat elements of a list with ```*```\r\n```dart\r\nList\u003cint\u003e l = [1, 2] * 3; // [1, 2, 1, 2, 1, 2]\r\n\r\n// Dart has this for Strings\r\nString s = 'hello' * 3; // 'hellohellohello'\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadsimple%2Fheart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadsimple%2Fheart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadsimple%2Fheart/lists"}