api_cep_search

Creator: coderz1093

Last updated:

0 purchases

api_cep_search Image
api_cep_search Images

Languages

Categories

Add to Cart

Description:

api cep search

api_cep_search #
Package para consulta de endereço via apiCEP.
Getting Started #
Insira a última versão em seu pubspec.yaml (and run dart pub get);
depencencies:
api_cep_search: ^1.0.5
copied to clipboard
Example #
Consulta de CEP via apiCEP.
Você pode passar um valor fixo ou variável para a função e ela retornará os dados do endereço:
/// basta passar um CEP válido sem p ' - ' para realizar a consulta
SearchCep.getInstance("15370496")
copied to clipboard

class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: FutureBuilder<SearchCep>(
future: SearchCep.getInstance("15370496"),
builder: (context, snapshot) {
if (snapshot.data == null) return Container();

return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
snapshot.data.code,
style: TextStyle(fontSize: 20),
),
Text(snapshot.data.state, style: TextStyle(fontSize: 20)),
Text(snapshot.data.city, style: TextStyle(fontSize: 20)),
Text(snapshot.data.district,
style: TextStyle(fontSize: 20)),
Text(snapshot.data.address, style: TextStyle(fontSize: 20)),
],
);
})),
);
}
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.