flutter_vali 1.0.0 copy "flutter_vali: ^1.0.0" to clipboard
flutter_vali: ^1.0.0 copied to clipboard

A comprehensive Flutter package for form validation and input handling, designed to simplify user input management and ensure data integrity in your applications.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_vali/flutter_vali.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: const ExamplePage());
  }
}

class ExamplePage extends StatelessWidget {
  const ExamplePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SingleChildScrollView(
        child: Form(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              TextFormField(
                decoration: InputDecoration(hintText: 'Enter your username'),
                validator: context.validators([
                  NotEmptyRule(),
                  MinLengthRule(
                    3,
                    errorMessage:
                        'Username must be at least 3 characters long.',
                  ),
                  MaxLengthRule(10),
                ]),
              ),
              TextFormField(
                decoration: InputDecoration(hintText: 'Enter your password'),
                validator:
                    context.validator
                        .notEmpty()
                        .minLength(
                          6,
                          errorMessage:
                              'Password must be at least 6 characters long.',
                        )
                        .maxLength(20)
                        .build(),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
160
points
42
downloads

Publisher

verified publisherthesmartcloud.tech

Weekly Downloads

A comprehensive Flutter package for form validation and input handling, designed to simplify user input management and ensure data integrity in your applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_vali