cpf_cnpj_validator 2.0.0
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")}"),
          ],
        ),
      ),
    );
  }
}
44
likes
110
pub points
94%
popularity

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