{"id":22046810,"url":"https://github.com/abitofevrything/runtime_type","last_synced_at":"2025-10-05T01:50:45.144Z","repository":{"id":64159533,"uuid":"573838410","full_name":"abitofevrything/runtime_type","owner":"abitofevrything","description":"A non-opaque representation of types at runtime.","archived":false,"fork":false,"pushed_at":"2023-12-28T21:32:57.000Z","size":19,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-08T19:17:04.172Z","etag":null,"topics":["dart","types"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/runtime_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/abitofevrything.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":"2022-12-03T15:41:14.000Z","updated_at":"2024-08-28T08:57:11.000Z","dependencies_parsed_at":"2023-12-28T22:28:11.539Z","dependency_job_id":"b09ca56e-97b4-44e9-b49a-0d8db187c184","html_url":"https://github.com/abitofevrything/runtime_type","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abitofevrything/runtime_type","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abitofevrything%2Fruntime_type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abitofevrything%2Fruntime_type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abitofevrything%2Fruntime_type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abitofevrything%2Fruntime_type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abitofevrything","download_url":"https://codeload.github.com/abitofevrything/runtime_type/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abitofevrything%2Fruntime_type/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278399610,"owners_count":25980331,"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-10-04T02:00:05.491Z","response_time":63,"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","types"],"created_at":"2024-11-30T13:20:14.404Z","updated_at":"2025-10-05T01:50:45.113Z","avatar_url":"https://github.com/abitofevrything.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# runtime_type\n\nA non-opaque representation of types at runtime.\n\nNormally, `Type` objects are opaque and cannot be used for actual logic. `RuntimeType` allows for operations such as sub- or super-type checking, type checks, and casting using a variable instead of a literal.\n\nTo use, replace your type literals with calls to the `RuntimeType` constructor:\n```dart\n// Before\nfinal stringType = String;\n// After\nfinal stringType = RuntimeType\u003cString\u003e();\n```\n\n### A word of warning\n\nPlease only use this library if you're sure it's what you want. If you're not completely at ease with the Dart language, ask someone who is whether your problem can be solved some other way, as Dart's type system is normally enough to handle problems.\n\n### How it works\n\nInstead of using `Type` instances to track information about a type, `RuntimeType` uses a generic type to hold the same information. Then, by using that generic and Dart's handling of generic subtype checking, we can implement most of the functions that normal type literals have.\n\nIf you've seen this trick before, this package uses the same principle:\n```dart\nbool isTypeASubtypeOfB\u003cA, B\u003e() =\u003e \u003cA\u003e[] is List\u003cB\u003e;\n```\n\nHowever, that trick does not work when `A` and `B` cannot be resolved statically - which is why this package creates `RuntimeType` objects statically, but which can then be passed around and used dynamically as the type information is held within the object itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabitofevrything%2Fruntime_type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabitofevrything%2Fruntime_type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabitofevrything%2Fruntime_type/lists"}