搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.1

queen_validators

用於 Flutter 表單的驗證方法和規則集合,無需額外小部件

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1140
喜歡數
80
Pub 分數
135

安裝套件

flutter pub add queen_validators

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Queen Validators 是一個輕量級的 Flutter 套件,提供一套完整的表單輸入驗證方法與規則,不需額外新增組件。它為常見使用情境(如電子郵件、密碼、電話號碼及自訂模式)提供乾淨且可重複使用的驗證邏輯。此套件設計簡潔且具高效率,能無縫整合至任何 Flutter 表單工作流程中,讓開發者能有效率地在 Android、iOS、Web、macOS、Windows 與 Linux 平台上驗證使用者輸入。非常適合尋求最小開銷與最大彈性的開發者。

適用情境

  • 表單輸入驗證
  • 電子郵件和電話號碼檢查
  • 密碼強度驗證
  • 自定義模式匹配
  • 即時表單反饋
  • 跨平台驗證

主要特色

  • 無額外組件
  • 豐富的內建驗證器
  • 支援自訂驗證規則
  • 輕量且快速
  • 跨平台相容性
  • 與 Form 小部件的輕鬆整合

適合對象

  • Flutter 開發人員建構表單
  • 需要嚴格輸入驗證的應用程式
  • 重視最小依賴項的團隊
  • 針對多個平台的專案
  • 希望實現簡單驗證邏輯的開發者

使用建議

  • 不包含 UI 組件
  • 需要與表單欄位進行手動整合
  • 僅限驗證邏輯
  • 無內建錯誤訊息
  • 不適合複雜的表單狀態管理

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Q U E E N 👑

For More Features OUT-OF-THE-BOX (localization) see Official Documentation site

Validators 🌍

Pub License: MIT issues Pull requests forks Starts style: lint codecov

Buy Me A Coffee

Usage

if you need

  • simple true of false function to validate a input
  • validate a normal flutter Form field
@override
Widget build(BuildContext context) {
return TextFormField(
     // use qValidator function and provider list of rules to apply on this field
    validator: qValidator([
      IsRequired(),
      IsOptional()
      IsEmail(),
      MinLength(8),
      MaxLength(30, "optionally you can override the failure if the validation fails"),
    ]),
  );
  }

customization

if you need to show a custom error message you can

  • use the rule constructor (scooped for a single rule)
  • use ValidatorsLocalization.on (scooped for the entire Type rules)
void main() {
    ValidatorsLocalization.on<IsRequired>((rule) => 'the new required message');
}
  • if you use queen all the rules are localized out of the box 🎁 !

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。