form_shield 0.4.0 copy "form_shield: ^0.4.0" to clipboard
form_shield: ^0.4.0 copied to clipboard

A declarative, rule-based form validation library for Flutter apps. Supports async validation, custom validation logic, and more.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'login_form_example.dart';
import 'async_validation_example.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Form Shield Examples',
      theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: true),
      home: const ExampleSelector(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Form Shield Examples')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const LoginFormExample(),
                  ),
                );
              },
              child: const Text('Basic Form Example'),
            ),
            const SizedBox(height: 16),
            ElevatedButton(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const AsyncValidationExample(),
                  ),
                );
              },
              child: const Text('Async Validation Example'),
            ),
            const SizedBox(height: 16),
          ],
        ),
      ),
    );
  }
}
copied to clipboard
14
likes
160
points
237
downloads

Publisher

verified publisherstevenosse.com

Weekly Downloads

2024.09.26 - 2025.04.10

A declarative, rule-based form validation library for Flutter apps. Supports async validation, custom validation logic, and more.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on form_shield