#GazzaUnderAttack

Queen validators 👑

style: lint

مقال يشرح بالعربي الفائده من المكتبة وطريقة الاستخدام

Features

  • support all platforms
  • support Null Safety
  • support Flutter Form validation
  • support variable validation

Table of Contents

Features

  • easily customize form validation error massages with any localization solution
  • need a new rule ? just extend QueenValidationRule class and build your own rule
  • extension on String and dynamic Types give you little push
  • Support null Safety

installation

dependencies:
  queen_validators: ^0.2.3

Validate Forms

import 'package/queen_validators/queen_validators.dart';
@override
Widget build(BuildContext context) {
return TextFormField(
     // use qValidator function and provider list of rules to apply on this field
    validator: qValidator([
      IsRequired(),
      IsEmail(),
      MinLength(8),
      MaxLength(30, "optionally you can override the failure if the validation fails"),
    ]),
  );
  }

Validate variables

const badEmail = 'QueenRoyal.kingdom';
print(badEmail.isEmail) // false

const validEmail = 'Queen@Royal.kingdom';
print(validEmail.isEmail) // true

Supported Rules

NOTE :

  • for basic form validation i think we cover big part of it
  • but for variables validation we miss a lot of functionalities and the tests does not cover every thing , if you would to help feel free to do so

Libraries

queen_validators