text_form_validator 1.0.6 text_form_validator: ^1.0.6 copied to clipboard
Provides a simple way to combine validation functions, failing and providing the most informative error to the user.
import "package:flutter/material.dart";
import "package:text_form_validator/form_validator.dart";
/// A very simple example showing how to add a [FormValidator] to a [TextFormField]
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: DemoPage(),
);
}
}
class DemoPage extends StatelessWidget {
const DemoPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: TextFormField(
validator: FormValidator.required().build(),
));
}
}