GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - flutter-studio/validator: A string or numeric validator for flutter

BranchesTags
Open more actions menu

Latest commit

 

History

21 Commits
21 Commits

Folders and files

NameName
Last commit message
Last commit date
example
example
 
 
lib
lib
 
 
.gitignore
.gitignore
 
 
.metadata
.metadata
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
README_zh-CN.md
README_zh-CN.md
 
 
package.json
package.json
 
 
pubspec.lock
pubspec.lock
 
 
pubspec.yaml
pubspec.yaml
 
 
validator.iml
validator.iml
 
 

Repository files navigation

English | 简体中文

smart_validator

pub package

A string or numeric validator for flutter,Including email, phone and so on

Usage

To use this plugin, add smart_validator as a dependency in your pubspec.yaml file.

Example

// Import package
import 'package:smart_validator/smart_validator.dart';

 Validator validator = Validator(rules: {
    "param1": [
      Required(message: "param1不能为空"), /// or  Required(message: ()=>"param1不能为空")
      Number(message: "param1必须是数字"), /// or  Number(message: ()=>"param1必须是数字")
      Range(max: Section(value: 10), min: Section(value: 1), message: "param1必须在1到10之间")
      /// or  Range(max: Section(value: ()=>10), min: Section(value: ()=>1), message: "param1必须在1到10之间")
    ],
  });

   print(validator.validate("param1", ""));
   // ValidResult{ pass: false, message: param1不能为空, filteredMsg: param1不能为空 }

   print(validator.validate("param1", "sdfsf"));
    // ValidResult{ pass: false, message: param1必须是数字, filteredMsg: param1必须是数字 }

   print(validator.validate("param1", "20"));
   // ValidResult{ pass: false, message: param1必须在1到10之间, filteredMsg: param1必须在1到10之间 }

   print(validator.validate("param1", "5"));
   // ValidResult{ pass: true, message: param1必须在1到10之间, filteredMsg:  }

About

A string or numeric validator for flutter

Topics

fluttervalidator

Resources

Readme
License
Activity
Custom properties

Stars

5 stars

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.