{"id":24044629,"url":"https://github.com/dev-cetera/df_type","last_synced_at":"2026-07-02T10:32:37.561Z","repository":{"id":251196258,"uuid":"836690321","full_name":"dev-cetera/df_type","owner":"dev-cetera","description":"Simplifies type conversions, inspections, nested data access, sync/async operations and more.","archived":false,"fork":false,"pushed_at":"2026-05-22T11:27:38.000Z","size":295,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-22T16:34:00.191Z","etag":null,"topics":["dart","library","package","types","utilities"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/df_type","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/dev-cetera.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["robmllze","dev-cetera"],"patreon":"RobertMollentze"}},"created_at":"2024-08-01T11:03:42.000Z","updated_at":"2026-05-22T11:27:42.000Z","dependencies_parsed_at":"2024-10-18T09:36:15.812Z","dependency_job_id":"7dd52a27-5068-436a-be98-dd302d219058","html_url":"https://github.com/dev-cetera/df_type","commit_stats":null,"previous_names":["robmllze/df_type","dev-cetera/df_type"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/dev-cetera/df_type","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cetera%2Fdf_type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cetera%2Fdf_type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cetera%2Fdf_type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cetera%2Fdf_type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dev-cetera","download_url":"https://codeload.github.com/dev-cetera/df_type/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dev-cetera%2Fdf_type/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35043933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-02T02:00:06.368Z","response_time":173,"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":["dart","library","package","types","utilities"],"created_at":"2025-01-08T23:32:32.434Z","updated_at":"2026-07-02T10:32:37.554Z","avatar_url":"https://github.com/dev-cetera.png","language":"Dart","funding_links":["https://github.com/sponsors/robmllze","https://github.com/sponsors/dev-cetera","https://patreon.com/RobertMollentze","https://www.buymeacoffee.com/dev_cetera","https://www.patreon.com/robelator"],"categories":[],"sub_categories":[],"readme":"[![pub](https://img.shields.io/pub/v/df_type.svg)](https://pub.dev/packages/df_type)\n[![tag](https://img.shields.io/badge/Tag-v0.16.0-purple?logo=github)](https://github.com/dev-cetera/df_type/tree/v0.16.0)\n[![buymeacoffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?logo=buy-me-a-coffee\u0026logoColor=black)](https://www.buymeacoffee.com/dev_cetera)\n[![sponsor](https://img.shields.io/badge/Sponsor-grey?logo=github-sponsors\u0026logoColor=pink)](https://github.com/sponsors/dev-cetera)\n[![patreon](https://img.shields.io/badge/Patreon-grey?logo=patreon)](https://www.patreon.com/robelator)\n[![discord](https://img.shields.io/badge/Discord-5865F2?logo=discord\u0026logoColor=white)](https://discord.gg/gEQ8y2nfyX)\n[![instagram](https://img.shields.io/badge/Instagram-E4405F?logo=instagram\u0026logoColor=white)](https://www.instagram.com/dev_cetera/)\n[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://raw.githubusercontent.com/dev-cetera/df_type/main/LICENSE)\n\n---\n\n\u003c!-- BEGIN _README_CONTENT --\u003e\n\n## Summary\n\nSmall, focused utilities for runtime type handling, lenient value coercion,\nand mixed sync/async flows in Dart. Hardened for **life-critical use**:\nsilent data corruption, masked errors, and silent saturations are all\ndefects, not features.\n\nWhat's in the box:\n\n- **Safe value coercion** — `letOrNull\u003cT\u003e(input)` plus a family of\n  `let{Int,Double,Bool,Num,Uri,DateTime,String,Iterable,List,Set,Map}OrNull`\n  helpers that return `null` on any failure instead of throwing. Rejects\n  silently-unsafe inputs (NaN, infinity, out-of-range doubles) rather than\n  saturating. `letIntOrNull` uses the runtime-correct safe bound on web\n  (`±2^53`) versus VM (`±2^63`). `letMapOrNull` rejects coerced-key\n  collisions instead of letting one entry overwrite another.\n- **Type-level inspection** — `isSubtype\u003cTChild, TParent\u003e()`,\n  `typeEquality\u003cT1, T2\u003e()`, and `isNullable\u003cT\u003e()` for generic-level checks\n  that aren't otherwise expressible in Dart.\n- **`FutureOr` orchestration** — `wait`, `waitF`, and the `consec1..consec9`\n  family run mixed sync/async work in argument order, with `eagerError` and\n  lifecycle callbacks (`onError`, `onComplete`). Stays synchronous when all\n  inputs are synchronous. The original error always reaches the caller —\n  buggy handlers are surfaced through `Zone.handleUncaughtError` but never\n  mask the incident. `onComplete` runs on every exit path.\n- **`Waiter\u003cT\u003e`** — a deferred batch of operations you can build up over\n  time and then execute together. Operations are stored as immutable\n  [`WaiterOperation\u003cT\u003e`](#waiteroperation--cross-isolate-friendly) value\n  objects, which makes the queue auditable and (when callers use top-level\n  functions) sendable across isolates.\n- **`decodeJsonbStrings`** — recursively decodes JSON-shaped strings inside\n  a value tree. Handy for Postgres `jsonb` columns that may arrive\n  pre-decoded or as raw JSON depending on the driver. Bounded by a\n  `maxDepth` parameter (default `64`) so hostile or pathological nesting\n  can't overflow the stack.\n- **Convenience extensions** — `Function.tryCall` (safe `Function.apply`,\n  but it deliberately does **not** swallow `Error` subtypes like\n  `StackOverflowError` or `AssertionError`), `Iterable\u003cEnum\u003e.valueOf`\n  (case-insensitive enum lookup), and `FutureOrExt` (`isFuture`,\n  `withMinDuration`, etc.).\n\n## Installation\n\n```sh\ndart pub add df_type\n# or, for a Flutter project:\nflutter pub add df_type\n```\n\n## Usage\n\n```dart\nimport 'package:df_type/df_type.dart';\n\nvoid main() async {\n  // Lenient scalar coercion.\n  letIntOrNull('42');           // 42\n  letIntOrNull('not a number'); // null\n  letIntOrNull(double.nan);     // null (never throws, never saturates)\n\n  // Nested collection coercion from a JSON string.\n  letMapOrNull\u003cString, int\u003e('{\"a\":1,\"b\":2}'); // {a: 1, b: 2}\n\n  // Mixed sync/async, results delivered in the order you passed them in.\n  final greeting = await consec3\u003cString, int, String, String\u003e(\n    Future.delayed(const Duration(milliseconds: 10), () =\u003e 'hello'),\n    42,\n    Future.value('world'),\n    (a, b, c) =\u003e '$a $b $c',\n  );\n  print(greeting); // hello 42 world\n\n  // Deferred batch of operations via Waiter — `addFn` is the\n  // closure-friendly shortcut; `add(WaiterOperation(...))` is the\n  // isolate-portable form.\n  final waiter = Waiter\u003cString\u003e()\n    ..addFn(() =\u003e 'sync result', id: 'a')\n    ..addFn(() async =\u003e 'async result', id: 'b');\n  final results = await waiter.wait();\n  print(results); // (sync result, async result)\n}\n```\n\n### `WaiterOperation` — cross-isolate friendly\n\n`Waiter` stores its queue as immutable `WaiterOperation\u003cT\u003e` value objects.\nEach carries a `run` function plus an optional `id` for auditing / logging.\nWhen `run` is a top-level or `static` function, the operation (and a list of\nthem) is safely sendable across an `Isolate` boundary:\n\n```dart\nint heavyTask() { /* ... */ }\n\nawait Isolate.run(() async {\n  final w = Waiter\u003cint\u003e(\n    operations: const [\n      WaiterOperation(heavyTask, id: 'compute-1'),\n      WaiterOperation(heavyTask, id: 'compute-2'),\n    ],\n  );\n  return (await w.wait()).toList();\n});\n```\n\nClosures (`() =\u003e ...`) capture their enclosing isolate and cannot cross a\n`SendPort` — that's a Dart runtime restriction, not something the package\nimposes. The value-object wrapper exists precisely so the choice between\n\"sendable\" (top-level/static) and \"local-only\" (closure) is explicit and\ninspectable at call sites.\n\n## Safety guarantees\n\n- **No silent failures.** Misused calls throw `ArgumentError` in every\n  build mode (no debug-only `assert`s). Coerced-key collisions in maps\n  cause the whole conversion to fail rather than silently overwriting.\n- **The original error always wins.** A buggy `onError` / `onComplete`\n  handler never replaces the underlying incident; its own failure is\n  surfaced via `Zone.handleUncaughtError` so it is still observable but\n  not in the caller's catch block.\n- **Cleanup always runs.** `onComplete` fires on every exit path,\n  including when `onError` itself throws.\n- **No critical-`Error` absorption.** `Function.tryCall` swallows\n  `Exception`, `TypeError`, and `NoSuchMethodError` only — `StackOverflow`,\n  `OutOfMemory`, `AssertionError`, and `StateError` propagate.\n- **Bounded recursion.** `decodeJsonbStrings` enforces a `maxDepth` (default\n  `64`) so hostile input cannot overflow the stack.\n- **No silent saturation of integers.** `letIntOrNull` returns `null`\n  outside the runtime-appropriate safe bound — `±2^63` on the VM, `±2^53`\n  on the JS runtime where `int` is double-backed.\n\n## Cross-platform and isolate safety\n\nThe library targets the Dart VM, the JS runtime (Flutter web, dart2js,\ndartdevc), and **WebAssembly via `dart compile wasm` / `flutter build web\n--wasm`**. It has no `dart:io` or `dart:isolate` imports under `lib/`, and\nall `lib/` sources are pure Dart with no JS-interop or platform conditional\nimports. A minimal program exercising the public surface bundles to roughly\n100 KB minified via dart2js, or ~85 KB of `.wasm` + ~13 KB of JS glue via\ndart2wasm — both dominated by the SDK runtime rather than this library.\n\nEvery top-level binding under `lib/` is `const` or `final` of an immutable\nexpression — there is **no shared mutable static state**, so multiple\nisolates can use the package concurrently without interference. A dedicated\n[`test/isolate_safety_test.dart`](test/isolate_safety_test.dart) suite\nproves this end-to-end on the VM by sending `Waiter`s and operations\nthrough `Isolate.run`.\n\n\u003c!-- END _README_CONTENT --\u003e\n\n---\n\n🔍 For more information, refer to the [API reference](https://pub.dev/documentation/df_type/).\n\n---\n\n## 💬 Contributing and Discussions\n\nThis is an open-source project, and we warmly welcome contributions from everyone, regardless of experience level. Whether you're a seasoned developer or just starting out, contributing to this project is a fantastic way to learn, share your knowledge, and make a meaningful impact on the community.\n\n### ☝️ Ways you can contribute\n\n- **Find us on Discord:** Feel free to ask questions and engage with the community here: https://discord.gg/gEQ8y2nfyX.\n- **Share your ideas:** Every perspective matters, and your ideas can spark innovation.\n- **Help others:** Engage with other users by offering advice, solutions, or troubleshooting assistance.\n- **Report bugs:** Help us identify and fix issues to make the project more robust.\n- **Suggest improvements or new features:** Your ideas can help shape the future of the project.\n- **Help clarify documentation:** Good documentation is key to accessibility. You can make it easier for others to get started by improving or expanding our documentation.\n- **Write articles:** Share your knowledge by writing tutorials, guides, or blog posts about your experiences with the project. It's a great way to contribute and help others learn.\n\nNo matter how you choose to contribute, your involvement is greatly appreciated and valued!\n\n### ☕ We drink a lot of coffee...\n\nIf you're enjoying this package and find it valuable, consider showing your appreciation with a small donation. Every bit helps in supporting future development. You can donate here: https://www.buymeacoffee.com/dev_cetera\n\n\u003ca href=\"https://www.buymeacoffee.com/dev_cetera\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" height=\"40\"\u003e\u003c/a\u003e\n\n## LICENSE\n\nThis project is released under the [MIT License](https://raw.githubusercontent.com/dev-cetera/df_type/main/LICENSE). See [LICENSE](https://raw.githubusercontent.com/dev-cetera/df_type/main/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-cetera%2Fdf_type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdev-cetera%2Fdf_type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdev-cetera%2Fdf_type/lists"}