{"id":15008622,"url":"https://github.com/texdc/specify-dart","last_synced_at":"2026-02-07T16:01:43.728Z","repository":{"id":56840306,"uuid":"79169823","full_name":"texdc/specify-dart","owner":"texdc","description":"Specification library for dart","archived":false,"fork":false,"pushed_at":"2017-02-05T03:01:15.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-19T19:32:57.515Z","etag":null,"topics":["dart","filter","specification"],"latest_commit_sha":null,"homepage":null,"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/texdc.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2017-01-16T23:45:05.000Z","updated_at":"2017-01-21T00:59:16.000Z","dependencies_parsed_at":"2022-08-28T23:30:57.845Z","dependency_job_id":null,"html_url":"https://github.com/texdc/specify-dart","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/texdc/specify-dart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/texdc%2Fspecify-dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/texdc%2Fspecify-dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/texdc%2Fspecify-dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/texdc%2Fspecify-dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/texdc","download_url":"https://codeload.github.com/texdc/specify-dart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/texdc%2Fspecify-dart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29199519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T14:35:27.868Z","status":"ssl_error","status_checked_at":"2026-02-07T14:25:51.081Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","filter","specification"],"created_at":"2024-09-24T19:19:44.350Z","updated_at":"2026-02-07T16:01:43.705Z","avatar_url":"https://github.com/texdc.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# specify\n\n[Specifications](https://www.martinfowler.com/apsupp/spec.pdf) allow simple classes to encapsulate business rules in a flexible,\ntestable, and reusable manner.\n\n## examples\n\n```dart\nimport 'package:specify/specify.dart';\n\nclass StringContains extends Specification\u003cString\u003e {\n    final String _substring;\n    StringContains(this._substring);\n    bool isSatisfiedBy(String aString) =\u003e aString.contains(_substring);\n}\n\nclass StringNotContains extends StringContains {\n    StringNotContains(String aSubstring) : super(aSubstring);\n    bool isSatisfiedBy(String aString) =\u003e !super.isSatisfiedBy(aString);\n}\n\nclass StringIn extends OrSpecification\u003cString\u003e {\n    StringIn(List\u003cString\u003e aWordList) : super(\n        aWordList.map((String aWord) =\u003e new StringContains(aWord)).toList()\n    );\n}\n\nclass StringNotIn extends AndSpecification\u003cString\u003e {\n    StringNotIn(List\u003cString\u003e aWordList) : super(\n        aWordList.map((String aWord) =\u003e new StringNotContains(aWord)).toList()\n    );\n}\n\nmain() {\n    StringIn    isWord    = new StringIn(['foo', 'bar']);\n    StringNotIn isNotWord = new StringNotIn(['baz', 'zim']);\n\n    print(isWord('barge'));\n    print(isNotWord('hello'));\n}\n```\n### filters\nFiltering with specifications can be very powerful, especially when used with `CompositeSpecification`.\n```dart\nimport 'package:specify/specify.dart';\n\nclass StringLength extends Specification\u003cString\u003e {\n    final int _length;\n\n    StringLength(this._length);\n\n    bool isSatisfiedBy(String aString) =\u003e aString.length == _length;\n}\n\nclass LengthFilter extends Filter\u003cString\u003e {\n    LengthFilter(int aLength) : super(new StringLength(aLength));\n}\n\nmain() {\n    LengthFilter filter = new LengthFilter(3);\n\n    print(filter(['foo', 'bar', 'nice', 'to', 'know', 'you']));\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftexdc%2Fspecify-dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftexdc%2Fspecify-dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftexdc%2Fspecify-dart/lists"}