Learn Mobile Development
Flutter PasswordValidator: A Flutter Package to Ensure Strong Passwords
Build a more secure App with Flutter
Introduction :
Validation is an essential aspect of building robust and reliable mobile applications, and it plays a significant role in ensuring that user inputs are correct and meet the expected criteria. In the context of Flutter, which is a popular open-source UI framework for building natively compiled applications for mobile, web, and desktop from a single codebase, you can implement validation to validate user inputs in forms and other interactive elements.
Add it to your package’s pubspec.yaml file:
dependencies:
flutter_pw_validator: ^1.6.0
Now in your Dart code, you can use:
import 'package:flutter_pw_validator/flutter_pw_validator.dart';
put this code in textfield
new TextField(
controller: _passwordController
),
new FlutterPwValidator(
controller: _passwordController,
minLength: 6,
uppercaseCharCount: 2,
lowercaseCharCount: 2,
numericCharCount: 3,
specialCharCount: 1,
width: 400,
height: 150,
onSuccess: yourCallbackFunction,
onFail: yourCallbackFunction
)
output:
FullCode :
❤ ❤ Thanks for reading dis article ❤❤
If I got something wrong? Let me no in the comments. I would love to improve.
Clap 👏 If this article halps you.