{"id":21056976,"url":"https://github.com/novaday-co/inspection","last_synced_at":"2025-05-15T23:33:38.292Z","repository":{"id":45474153,"uuid":"298253486","full_name":"novaday-co/inspection","owner":"novaday-co","description":"validation form inputs in Dart \u0026 Flutter","archived":false,"fork":false,"pushed_at":"2021-12-12T11:39:02.000Z","size":72,"stargazers_count":20,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T17:13:06.644Z","etag":null,"topics":["android","dart","flutter","form-validation","form-validator","inspection","ios","laravel-validation","validation","web"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/inspection","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/novaday-co.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":"2020-09-24T11:08:38.000Z","updated_at":"2024-03-25T23:12:33.000Z","dependencies_parsed_at":"2022-07-18T23:47:41.967Z","dependency_job_id":null,"html_url":"https://github.com/novaday-co/inspection","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/novaday-co%2Finspection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novaday-co%2Finspection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novaday-co%2Finspection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novaday-co%2Finspection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/novaday-co","download_url":"https://codeload.github.com/novaday-co/inspection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442429,"owners_count":22071864,"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":["android","dart","flutter","form-validation","form-validator","inspection","ios","laravel-validation","validation","web"],"created_at":"2024-11-19T16:55:25.117Z","updated_at":"2025-05-15T23:33:33.230Z","avatar_url":"https://github.com/novaday-co.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/novaday-co/inspection/master/assets/inspection_header.png\" height=\"170\" alt=\"Flutter Inspection Package\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pub.dev/packages/inspection\"\u003e\u003cimg src=\"https://img.shields.io/pub/v/inspection.svg\" alt=\"Pub\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-purple.svg\" alt=\"License: MIT\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n---\n\n\n# Inspection\n\nWith **Inspection** you can validate your inputs in **Flutter** \u0026 **Dart** like **Laravel Framework**.\n\n## How to install :\n\nAdd this to your package's pubspec.yaml file:\n\n```yaml\ndependencies:\n  inspection: ^0.0.14\n```\n\nThen You can install packages from the command line:\n```yaml\n$ pub get\n```\n\nor\n\n```yaml\n$ flutter pub get\n```\n\nAlternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.\n\nNow in your Dart code, you can use:\n\n```dart\nimport 'package:inspection/inspection.dart';\n```\n\n## Basic Usage :\n\nYou have a form , you want to validate inputs everyday in programming . With **Inspection** you can validate your inputs in **Dart** like **Laravel Framework** . See examples below .\n\nYou expect a required number with many conditions and rules :\nIn this case , we get help from **Inspection** helper function .\n\n```dart\n  TextFormField(\n    validator: (input) =\u003e inspection(input, 'required|numeric|between:2000,6000|contains:22,33,55|ends_with:0'),\n  ),\n```\n\nYou can use **Inspection** class :\n\n```dart\n  TextFormField(\n    validator: (input) =\u003e Inspection().inspect(input, 'required|float'),\n  ),\n```\n\nAnd you can use helper function and **Inspection** class with **List** of rules , so you can make a global validation configuration List and you can change your rules in whole of the application whenever you want.\n\n```dart\n  TextFormField(\n    validator: (input) =\u003e inspection(input, ['required','float']),\n  ),\n```\n\nor \n\n```dart\nTextFormField(\n    validator: (input) =\u003e inspect(input, ['required','float']),\n  ),\n```\n\n## Options :\nYou can set attribute **name** , custom **message** and **locale** . For example :\n\n```dart\nTextFormField(\n    validator: (input) =\u003e inspect(input, 'required|float',message: 'my custom message here !'),\n  ),\n```\n\n\n## Rules :\n\n\n| Rule       \t| Description                         \t| Example                     \t|\n|------------\t|-------------------------------------\t|-----------------------------\t|\n| iran_national_code\t| Input must be a iranian national code | inspect(input,'iran_national_code') \t|\n| have_alpha \t| The attribute must have alpha in it \t| inspect(input,'have_alpha') \t|\n| alpha_num\t \t| The attribute must contains only letters and numbers \t| inspect(input,'alpha_num')\t|\n| between\t \t| The attribute must be between :min and :max \t| inspect(input,'between:3,9')\t \t|\n| contains\t \t| The attribute must contains one of your worlds \t| inspect(input,'contains:farid,farhad')\t \t|\n| email\t \t\t| The attribute must be a valid email \t| inspect(input,'email')\t \t|\n| ends_with\t \t| The attribute must ends with your pattern \t| inspect(input,'ends_with:bye')\t|\n| gt\t \t\t| The attribute must grater than :gt \t| inspect(input,'gt:10')\t \t\t|\n| gte\t \t\t| The attribute must grater than or equal to :gte \t| inspect(input,'gte:10')\t \t\t|\n| hex\t \t\t| The attribute must be a valid hex code \t| inspect(input,'hex')\t \t\t|\n| in\t \t\t| The attribute must be one of options in your list\t| inspect(input,'in:farid,farhad,john')\t \t\t|\n| ip\t \t\t| The attribute must be a valid IP \t| inspect(input,'ip')\t \t\t|\n| lt\t \t\t| The attribute must be less than :lt \t| inspect(input,'lt:100')\t \t\t|\n| lte\t \t\t| The attribute must be less than or equal to :lte \t| inspect(input,'lte:100')\t \t\t|\n| max\t \t\t| The attribute must have maximum :max character \t| inspect(input,'max:10')\t \t\t|\n| min\t \t\t| The attribute must have at least :min character \t| inspect(input,'min:3')\t \t\t|\n| not_in\t \t| The attribute must not exists in list :not_in \t| inspect(input,'not_in:saman,ahmad')\t \t|\n| numeric\t \t| The attribute must be a number\t| inspect(input,'numeric') \t\t|\n| alpha\t \t\t| The attribute must contains only letters \t| inspect(input,'alpha') \t\t|\n| float\t \t\t| The attribute must be float \t| inspect(input,'float') \t\t|\n| integer\t \t| The attribute must be integer \t| inspect(input,'integer') \t\t|\n| number\t \t| The attribute must contains only number \t| inspect(input,'number') \t\t|\n| regex\t \t\t| The attribute must match with regex \t| inspect(input,'regex:\\^[a-zA-Z0-9]') \t\t|\n| required\t \t| The attribute field is required \t| inspect(input,'required') \t|\n| starts_with\t| The attribute must starts with your pattern \t| inspect(input,'starts_with:hi') \t|\n| url\t \t\t| The attribute must be a valid url \t| inspect(input,'url') \t\t\t|\n\n\n## Locales :\n\n**Inspection** supports two languages now . **English** with code : **en** , and **Persian** with code **fa** and **Vietnamese** with code **vi**. You can set locale when initialize **inspection** or in optional parameter of **inspect** method. For example : \n\n```dart\n  TextFormField(\n    validator: (input) =\u003e Inspection(inspectionLocale : 'fa').inspect(input, 'required|in:farid,farhad'),\n  ),\n```\n\nor\n\n```dart\n  TextFormField(\n    validator: (input) =\u003e Inspection().inspect(input, 'required|in:farid,farhad',locale:'fa'),\n  ),\n```\n\n## Custom Rules :\nYou can simply extend from **Inspection** class and develop your custom rule . For example :\n\n```dart\nclass CustomInspection extends Inspection {\n  String myCustomRule(ruleString, inspectionCase) {\n    switch (ruleString) {\n      case 'myCustomRule':\n        // Your conditional codes here or copy from a Rule class and change it to your own . \n        return MyCustomeRuleClass(inspectionCase).stringValidation();\n    }\n    return null;\n  }\n}\n```\n\n## Contribute :\nYou can help me and contribute for :\n- New rules\n- More locales\n- Better exceptions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovaday-co%2Finspection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnovaday-co%2Finspection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovaday-co%2Finspection/lists"}