cpf_cnpj_validator 2.0.0 copy "cpf_cnpj_validator: ^2.0.0" to clipboard
cpf_cnpj_validator: ^2.0.0 copied to clipboard

A lib to validate, format, strip and generate CPF and CNPJ numbers from Brazil.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:cpf_cnpj_validator/cpf_validator.dart';
import 'package:cpf_cnpj_validator/cnpj_validator.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Text("CPF is valid: ${CPFValidator.isValid("334.616.710-02")}"),
            Text("CNPJ is valid: ${CNPJValidator.isValid("12.175.094/0001-19")}"),
          ],
        ),
      ),
    );
  }
}
80
likes
140
pub points
95%
popularity

Publisher

unverified uploader

A lib to validate, format, strip and generate CPF and CNPJ numbers from Brazil.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_test

More

Packages that depend on cpf_cnpj_validator