{"id":24702213,"url":"https://github.com/flutter-studio/validator","last_synced_at":"2025-10-09T08:30:19.650Z","repository":{"id":56839833,"uuid":"178316323","full_name":"flutter-studio/validator","owner":"flutter-studio","description":"A string or numeric validator for flutter","archived":false,"fork":false,"pushed_at":"2019-11-20T06:13:18.000Z","size":76,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-17T04:11:50.542Z","etag":null,"topics":["flutter","validator"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flutter-studio.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}},"created_at":"2019-03-29T02:18:01.000Z","updated_at":"2020-10-31T17:00:09.000Z","dependencies_parsed_at":"2022-08-28T23:30:29.358Z","dependency_job_id":null,"html_url":"https://github.com/flutter-studio/validator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flutter-studio%2Fvalidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flutter-studio%2Fvalidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flutter-studio%2Fvalidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flutter-studio%2Fvalidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flutter-studio","download_url":"https://codeload.github.com/flutter-studio/validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235807687,"owners_count":19047985,"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":["flutter","validator"],"created_at":"2025-01-27T05:32:24.435Z","updated_at":"2025-10-09T08:30:14.292Z","avatar_url":"https://github.com/flutter-studio.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"English | [简体中文](./README_zh-CN.md)\n\n# smart_validator\n\n[![pub package](https://img.shields.io/pub/v/smart_validator.svg)](https://pub.dartlang.org/packages/smart_validator)\n\nA string or numeric validator for flutter，Including email, phone and so on\n\n## Usage\nTo use this plugin, add `smart_validator` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).\n\n## Example\n\n``` dart\n// Import package\nimport 'package:smart_validator/smart_validator.dart';\n\n Validator validator = Validator(rules: {\n    \"param1\": [\n      Required(message: \"param1不能为空\"), /// or  Required(message: ()=\u003e\"param1不能为空\")\n      Number(message: \"param1必须是数字\"), /// or  Number(message: ()=\u003e\"param1必须是数字\")\n      Range(max: Section(value: 10), min: Section(value: 1), message: \"param1必须在1到10之间\")\n      /// or  Range(max: Section(value: ()=\u003e10), min: Section(value: ()=\u003e1), message: \"param1必须在1到10之间\")\n    ],\n  });\n\n   print(validator.validate(\"param1\", \"\"));\n   // ValidResult{ pass: false, message: param1不能为空, filteredMsg: param1不能为空 }\n\n   print(validator.validate(\"param1\", \"sdfsf\"));\n    // ValidResult{ pass: false, message: param1必须是数字, filteredMsg: param1必须是数字 }\n\n   print(validator.validate(\"param1\", \"20\"));\n   // ValidResult{ pass: false, message: param1必须在1到10之间, filteredMsg: param1必须在1到10之间 }\n\n   print(validator.validate(\"param1\", \"5\"));\n   // ValidResult{ pass: true, message: param1必须在1到10之间, filteredMsg:  }\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflutter-studio%2Fvalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflutter-studio%2Fvalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflutter-studio%2Fvalidator/lists"}