[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9446":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":16,"starSnapshotCount":16,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},9446,"dartx","simc\u002Fdartx","simc","Superpowers for Dart. Collection of useful static extension methods.","https:\u002F\u002Fpub.dev\u002Fpackages\u002Fdartx",null,"Dart",1094,91,12,20,0,1,53.99,"Apache License 2.0",false,"master",[23,24,25,26,27],"dart","flutter","hacktoberfest","static-extension","superpowers","2026-06-12 04:00:44","\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fleisim\u002Fdartx\u002Fmaster\u002F.github\u002Flogo.svg?sanitize=true\" width=\"500px\">\n\n[![Dart CI](https:\u002F\u002Fgithub.com\u002Fleisim\u002Fdartx\u002Fworkflows\u002FDart%20CI\u002Fbadge.svg?branch=master)](https:\u002F\u002Fgithub.com\u002Fleisim\u002Fdartx\u002Factions) [![Codecov](https:\u002F\u002Fimg.shields.io\u002Fcodecov\u002Fc\u002Fgithub\u002Fleisim\u002Fdartx.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fleisim\u002Fdartx) [![dartx](https:\u002F\u002Fimg.shields.io\u002Fpub\u002Fv\u002Fdartx?label=dartx)](https:\u002F\u002Fpub.dev\u002Fpackages\u002Fdartx) [![flutterx](https:\u002F\u002Fimg.shields.io\u002Fpub\u002Fv\u002Fflutterx?label=flutterx)](https:\u002F\u002Fpub.dev\u002Fpackages\u002Fflutterx)\n\n_If you miss an extension, please open an issue or pull request_\n\n### Resources:\n\n- [Documentation](https:\u002F\u002Fpub.dev\u002Fdocumentation\u002Fdartx\u002Flatest\u002Fdartx\u002Fdartx-library.html)\n- [Pub Package](https:\u002F\u002Fpub.dev\u002Fpackages\u002Fdartx)\n- [GitHub Repository](https:\u002F\u002Fgithub.com\u002Fleisim\u002Fdartx)\n\nOn this page you can find some of the extensions. Take a look at the docs to see all of them.\n\n## Getting started 🎉\n\nAdd the following to your `pubspec.yaml`:\n\n```dart\ndependencies:\n  dartx: any\n```\n\nAfter you import the library, you can use the extensions.\n\n```dart\nimport 'package:dartx\u002Fdartx.dart';\n\nfinal slice = [1, 2, 3, 4, 5].slice(1, -2); \u002F\u002F [2, 3, 4]\n```\n\n## Iterable\n\n### .slice()\n\nReturns elements at indices between `start` (inclusive) and `end` (inclusive).\n\n```dart\nfinal list = [0, 1, 2, 3, 4, 5];\nfinal last = list.slice(-1); \u002F\u002F [5]\nfinal lastHalf = list.slice(3); \u002F\u002F [3, 4, 5]\nfinal allButFirstAndLast = list.slice(1, -2); \u002F\u002F [1, 2, 3, 4]\n```\n\n### .sortedBy() & .thenBy()\n\nSort lists by multiple properties.\n\n```dart\nfinal dogs = [\n  Dog(name: \"Tom\", age: 3),\n  Dog(name: \"Charlie\", age: 7),\n  Dog(name: \"Bark\", age: 1),\n  Dog(name: \"Cookie\", age: 4),\n  Dog(name: \"Charlie\", age: 2),\n];\n\nfinal sorted = dogs\n    .sortedBy((dog) => dog.name)\n    .thenByDescending((dog) => dog.age);\n\u002F\u002F Bark, Charlie (7), Charlie (2), Cookie, Tom\n```\n\n### .distinctBy()\n\nGet distinct elements from a list.\n\n```dart\nfinal list = ['this', 'is', 'a', 'test'];\nfinal distinctByLength = list.distinctBy((it) => it.length); \u002F\u002F ['this', 'is', 'a']\n```\n\n### .flatten()\n\nGet a new lazy `Iterable` of all elements from all collections in a collection.\n\n```dart\nfinal nestedList = [[1, 2, 3], [4, 5, 6]];\nfinal flattened = nestedList.flatten(); \u002F\u002F [1, 2, 3, 4, 5, 6]\n```\n\n### .chunkWhile() & .splitWhen()\n\nChunk entries as long as two elements match a predicate:\n\n```dart\nfinal list = [1, 2, 4, 9, 10, 11, 12, 15, 16, 19, 20, 21];\nfinal increasingSubSequences = list.chunkWhile((a, b) => a + 1 == b);\n\n\u002F\u002F increasingSubSequences = [[1, 2], [4], [9, 10, 11, 12], [15, 16], [19, 20, 21]]\n```\n\n`splitWhen` is the opposite of `chunkWhile` that starts a new chunk every time\nthe predicate _didn't_ match.\n\n## int\n\n### buildString()\n\nBuilds new string by populating newly created `StringBuffer` using provided `builderAction`\nand then converting it to `String`.\n\n```dart\nfinal word = buildString((sb) {\n  for (var i = 0; i \u003C 10; i++) {\n    sb.write(i);\n  }\n});\n\u002F\u002F 0123456789\n```\n\n### .ordinal\n\nReturns an ordinal number of `String` type for any integer\n\n```dart\nfinal a = 1.ordinal();  \u002F\u002F 1st\nfinal b = 108.ordinal();  \u002F\u002F 108th\n```\n\n## String\n\n### .capitalize\n\nReturns a copy of the string having its first letter uppercased, or the original string, if it's empty or already starts with an upper case letter.\n\n```dart\nfinal word = 'abcd'.capitalize(); \u002F\u002F Abcd\nfinal anotherWord = 'Abcd'.capitalize(); \u002F\u002F Abcd\n```\n\n### .decapitalize\n\nReturns a copy of the string having its first letter lowercased, or the original string, if it's empty or already starts with a lower case letter.\n\n```dart\nfinal word = 'abcd'.decapitalize(); \u002F\u002F abcd\nfinal anotherWord = 'Abcd'.decapitalize(); \u002F\u002F abcd\n```\n\n### .isAscii\n\nReturns `true` if the string is ASCII encoded.\n\n```dart\nfinal isAscii = 'abc123 !,.~'.isAscii; \u002F\u002F true\nfinal isNotAscii = '§3'.isAscii; \u002F\u002F false\n```\n\n### .isBlank\n\nReturns `true` if this string is empty or consists solely of whitespace characters.\n\n```dart\nfinal notBlank = '   .'.isBlank; \u002F\u002F false\nfinal blank = '  '.isBlank; \u002F\u002F true\n```\n\n### .isDouble\n\nReturns `true` if the string can be parsed as a double.\n\n```dart\nfinal a = ''.isDouble; \u002F\u002F false\nfinal b = 'a'.isDouble; \u002F\u002F false\nfinal c = '1'.isDouble; \u002F\u002F true\nfinal d = '1.0'.isDouble; \u002F\u002F true\nfinal e = '123456789.987654321'.isDouble; \u002F\u002F true\nfinal f = '1,000'.isDouble; \u002F\u002F false\n```\n\n### .isInt\n\nReturns `true` if the string can be parsed as an integer.\n\n```dart\nfinal a = ''.isInt; \u002F\u002F false\nfinal b = 'a'.isInt; \u002F\u002F false\nfinal c = '1'.isInt; \u002F\u002F true\nfinal d = '1.0'.isInt; \u002F\u002F false\nfinal e = '1,000'.isInt; \u002F\u002F false\n```\n\n### .isLatin1\n\nReturns `true` if the string is Latin 1 encoded.\n\n```dart\nfinal isLatin1 = '§Êü'.isLatin1; \u002F\u002F true\nfinal isNotLatin1 = 'ő'.isLatin1; \u002F\u002F false\n```\n\n### .isLowerCase\n\nReturns `true` if the entire string is lower case.\n\n```dart\nfinal a = 'abc'.isLowerCase; \u002F\u002F true\nfinal b = 'abC'.isLowerCase; \u002F\u002F false\nfinal c = '   '.isLowerCase; \u002F\u002F true\nfinal d = ''.isLowerCase; \u002F\u002F false\n```\n\n### .isNotBlank\n\nReturns `true` if this string is not empty and contains characters except whitespace characters.\n\n```dart\nfinal blank = '  '.isNotBlank; \u002F\u002F false\nfinal notBlank = '   .'.isNotBlank; \u002F\u002F true\n```\n\n### .isNullOrEmpty\n\nReturns `true` if the String is either `null` or empty.\n\n```dart\nfinal isNull = null.isNullOrEmpty; \u002F\u002F true\nfinal isEmpty = ''.isNullOrEmpty; \u002F\u002F true\nfinal isBlank = ' '.isNullOrEmpty; \u002F\u002F false\nfinal isLineBreak = '\\n'.isNullOrEmpty; \u002F\u002F false\n```\n\n### .isNotNullOrEmpty\n\nReturns `true` if the String is neither `null` nor empty.\n\n```dart\nfinal isNull = null.isNullOrEmpty; \u002F\u002F true\nfinal isEmpty = ''.isNullOrEmpty; \u002F\u002F true\nfinal isBlank = ' '.isNullOrEmpty; \u002F\u002F false\nfinal isLineBreak = '\\n'.isNullOrEmpty; \u002F\u002F false\n```\n\n### .isNullOrBlank\n\nReturns `true` if the String is either `null` or blank.\n\n```dart\nfinal isNull = null.isNullOrBlank; \u002F\u002F true\nfinal isEmpty = ''.isNullOrBlank; \u002F\u002F true\nfinal isBlank = ' '.isNullOrBlank; \u002F\u002F true\nfinal isLineBreak = '\\n'.isNullOrBlank; \u002F\u002F true\nfinal isFoo = ' foo '.isNullOrBlank; \u002F\u002F false\n```\n\n### .isNotNullOrBlank\n\nReturns `true` if the String is neither `null` nor blank.\n\n```dart\nfinal isNull = null.isNullOrBlank; \u002F\u002F true\nfinal isEmpty = ''.isNullOrBlank; \u002F\u002F true\nfinal isBlank = ' '.isNullOrBlank; \u002F\u002F true\nfinal isLineBreak = '\\n'.isNullOrBlank; \u002F\u002F true\nfinal isFoo = ' foo '.isNullOrBlank; \u002F\u002F true\n```\n\n### .isUpperCase\n\nReturns `true` if the entire string is upper case.\n\n```dart\nfinal a = 'ABC'.isUpperCase; \u002F\u002F true\nfinal b = 'ABc'.isUpperCase; \u002F\u002F false\nfinal c = '   '.isUpperCase; \u002F\u002F true\nfinal d = ''.isUpperCase; \u002F\u002F false\n```\n\n### .md5\n\nCalculates the MD5 digest and returns the value as a string of hexadecimal digits.\n\n```dart\nfinal a = 'abc'.md5; \u002F\u002F 900150983cd24fb0d6963f7d28e17f72\nfinal b = 'ഐ⌛酪Б👨‍👨‍👧‍👦'.md5; \u002F\u002F c7834eff7c967101cfb65b8f6d15ad46\n```\n\n### .urlEncode\n\nTranslates a string into application\u002Fx-www-form-urlencoded format using a specific encoding scheme.\n\n```dart\nconst originalUrl = 'Hello Ladies + Gentlemen, a signed OAuth request!';\nfinal encodedUrl = originalUrl.urlEncode;\n\u002F\u002F 'Hello%20Ladies%20+%20Gentlemen,%20a%20signed%20OAuth%20request!'\n```\n\n### .urlDecode\n\nDecodes an application\u002Fx-www-form-urlencoded string using a specific encoding scheme.\n\n```dart\nconst encodedUrl = 'Hello%20Ladies%20+%20Gentlemen,%20a%20signed%20OAuth%20request!';\nfinal decodedUrl = encodingUrl.urlDecode;\n\u002F\u002F 'Hello Ladies + Gentlemen, a signed OAuth request!'\n```\n\n### .removePrefix(), .removeSuffix() and .removeSurrounding()\n\nRemove a prefix, a suffix, or both from a given string:\n\n```dart\nfinal name = 'James Bond'.removePrefix('James '); \u002F\u002F Bond\nfinal milliseconds = '100ms'.removeSuffix('ms'); \u002F\u002F 100\nfinal text = '\u003Cp>Some HTML\u003C\u002Fp>'\n  .removeSurrounding(prefix: '\u003Cp>', suffix: '\u003C\u002Fp>'); \u002F\u002F Some HTML\n```\n\n### .reversed\n\nReturns a new string with characters in reversed order.\n\n```dart\nfinal emptyString = ''.reversed; \u002F\u002F ''\nfinal reversed = 'abc🤔'.reversed; \u002F\u002F '🤔cba'\n```\n\n### .slice()\n\nReturns a new substring containing all characters including indices [start] and [end].\nIf [end] is omitted, it is being set to `lastIndex`.\n\n```dart\nfinal sliceOne = 'awesomeString'.slice(0,6)); \u002F\u002F awesome\nfinal sliceTwo = 'awesomeString'.slice(7)); \u002F\u002F String\n```\n\n### .toDoubleOrNull()\n\nParses the string as a `double` and returns the result or `null` if the String is not a valid representation of a number.\n\n```dart\nfinal numOne = '1'.toDoubleOrNull(); \u002F\u002F 1.0\nfinal numTwo = '1.2'.toDoubleOrNull(); \u002F\u002F 1.2\nfinal blank = ''.toDoubleOrNull(); \u002F\u002F null\n```\n\n### .toInt()\n\nParses the string as an integer and returns the result. The radix (base) thereby defaults to 10. Throws a `FormatException` if parsing fails.\n\n```dart\nfinal a = '1'.toInt(); \u002F\u002F 1\nfinal b = '100'.toInt(radix: 2); \u002F\u002F 4\nfinal c = '100'.toInt(radix: 16); \u002F\u002F 256\nfinal d = '1.0'.toInt(); \u002F\u002F throws FormatException\n```\n\n### .toIntOrNull()\n\nParses the string as an integer or returns `null` if it is not a number.\n\n```dart\nfinal number = '12345'.toIntOrNull(); \u002F\u002F 12345\nfinal notANumber = '123-45'.toIntOrNull(); \u002F\u002F null\n```\n\n### .toUtf8()\n\nConverts String to UTF-8 encoding.\n\n```dart\nfinal emptyString = ''.toUtf8(); \u002F\u002F []\nfinal hi = 'hi'.toUtf8(); \u002F\u002F [104, 105]\nfinal emoji = '😄'.toUtf8(); \u002F\u002F [240, 159, 152, 132]\n\n```\n\n### .toUtf16()\n\nConverts String to UTF-16 encoding.\n\n```dart\nfinal emptyString = ''.toUtf16(); \u002F\u002F []\nfinal hi = 'hi'.toUtf16(); \u002F\u002F [104, 105]\nfinal emoji = '😄'.toUtf16(); \u002F\u002F [55357, 56836]\n```\n\n### .orEmpty()\n\nReturns the string if it is not `null`, or the empty string otherwise.\n\n```dart\nString? nullableStr;\nfinal str = nullableStr.orEmpty(); \u002F\u002F ''\n```\n\n### .matches()\n\nReturns `true` if this char sequence matches the given regular expression.\n\n```dart\nprint('as'.matches(RegExp('^.s\\$'))) \u002F\u002F true\nprint('mst'.matches(RegExp('^.s\\$'))) \u002F\u002F false\n```\n\n### Time utils\n\nDartx exports [@jogboms](https:\u002F\u002Fgithub.com\u002Fjogboms) great [⏰ time.dart](https:\u002F\u002Fgithub.com\u002Fjogboms\u002Ftime.dart) package so you can do the following:\n\n```dart\nint secondsInADay = 1.days.inSeconds;\n\nDuration totalTime = [12.5.seconds, 101.milliseconds, 2.5.minutes].sum();\n\nDateTime oneWeekLater = DateTime.now() + 1.week;\n```\n\nCheck out [⏰ time.dart](https:\u002F\u002Fgithub.com\u002Fjogboms\u002Ftime.dart) for more information and examples.\n\n## num\n\n### .coerceIn()\n\nEnsures that this value lies in the specified range.\n\n```dart\nfinal numberInRange = 123.coerceIn(0, 1000); \u002F\u002F 123\nfinal numberOutOfRange = -123.coerceIn(0, 1000); \u002F\u002F 0\n```\n\n### .toBytes()\n\nConverts this value to binary form.\n\n### .toChar()\n\nConverts this value to character\n\n```dart\nfinal character = 97.toChar(); \u002F\u002F a\n```\n\n## range\n\n### rangeTo\n\nCreates a range between two ints (upwards, downwards and with custom steps)\n\n```dart\n\u002F\u002F upwards with default step size 1\nfor (final i in 1.rangeTo(5)) {\n  print(i); \u002F\u002F 1, 2, 3, 4, 5\n}\n\u002F\u002F downwards with custom step\nfor (final i in 10.rangeTo(2).step(2)) {\n  print(i); \u002F\u002F 10, 8, 6, 4, 2\n}\n```\n\n## Function\n\n### .partial(), .partial2() ...\n\nApplies some of the required arguments to a function and returns a function which takes the remaining arguments.\n\n```dart\nvoid greet(String firstName, String lastName) {\n  print('Hi $firstName $lastName!');\n}\n\nfinal greetStark = greet.partial('Stark');\ngreetStark('Sansa'); \u002F\u002F Hi Sansa Stark!\ngreetStark('Tony'); \u002F\u002F Hi Tony Stark!\n```\n\n## File\n\n### .name\n\nGet the name and extension of a file.\n\n```dart\nfinal file = File('some\u002Fpath\u002FtestFile.dart');\nprint(file.name); \u002F\u002F testFile.dart\nprint(file.nameWithoutExtension); \u002F\u002F testFile\n```\n\n### .appendText()\n\nAppend text to a file.\n\n```dart\nawait File('someFile.json').appendText('{test: true}');\n```\n\n### .isWithin()\n\nChecks if a file is inside a directory.\n\n```dart\nfinal dir = Directory('some\u002Fpath');\nFile('some\u002Fpath\u002Ffile.dart').isWithin(dir); \u002F\u002F true\n```\n\n## Directory\n\n### .file(String)\n\nReferences a file within a `Directory`\n\n```dart\nDirectory androidDir = Directory('flutter-app\u002Fandroid');\nFile manifestFile = androidDir.file(\"app\u002Fsrc\u002Fmain\u002FAndroidManifest.xml\");\n```\n\nReferences a directory within a `Directory`\n\n### .directory(String)\n\n```dart\nDirectory androidDir = Directory('flutter-app\u002Fandroid');\nDirectory mainSrc = androidDir.directory(\"app\u002Fsrc\u002Fmain\");\n```\n\n### .contains(FileSystemEntity entity, {bool recursive = false})\n\nChecks if a `Directory` contains a `FileSystemEntity`. This can be a `File` or a `Directory`.\n\nUse the `recursive` argument to include the subdirectories.\n\n```dart\nfinal File someFile = File('someFile.txt');\nfinal Directory someDir = Directory('some\u002Fdir');\n\nfinal Directory parentDir = Directory('parent\u002Fdir');\n\nparentDir.contains(someFile);\nparentDir.contains(someDir);\nparentDir.contains(someFile, recursive: true);\nparentDir.contains(someDir, recursive: true);\n```\n\nThis is the `async` method, which returns a `Future\u003Cbool>`.\n\n### .containsSync(FileSystemEntity entity, {bool recursive = false})\n\nSame as `.contains(FileSystemEntity entity, {bool recursive = false})` but synchronous. Returns a `bool`.\n\n## License\n\n```plain\nCopyright 2019 Simon Leier\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","dartx 是一个为 Dart 语言提供一系列实用静态扩展方法的库，旨在增强 Dart 的功能。其核心功能包括对集合、迭代器等常用数据结构的操作扩展，如切片、多属性排序、去重、展平以及按条件分块等，显著提升了代码编写效率与可读性。此外，该库还提供了针对整数类型的一些便捷方法，比如构建字符串等功能。适用于需要提高 Dart 或 Flutter 项目开发效率的各种场景，尤其是当开发者希望以更简洁直观的方式处理复杂数据操作时。",2,"2026-06-11 03:22:40","top_language"]