{"id":32273115,"url":"https://github.com/vitoramaral10/flutter_cep2","last_synced_at":"2026-02-23T14:33:39.111Z","repository":{"id":43730123,"uuid":"418651729","full_name":"vitoramaral10/flutter_cep2","owner":"vitoramaral10","description":"A Brazilian ZIP code (CEP) lookup library for Dart and Flutter applications. Supports multiple output formats including JSON and XML.","archived":false,"fork":false,"pushed_at":"2025-08-07T13:06:15.000Z","size":195,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T23:21:37.279Z","etag":null,"topics":["address","brazil","cep","postal-code","viacep"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/flutter_cep2","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitoramaral10.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-18T20:06:33.000Z","updated_at":"2025-08-07T13:06:19.000Z","dependencies_parsed_at":"2022-09-01T22:11:57.772Z","dependency_job_id":null,"html_url":"https://github.com/vitoramaral10/flutter_cep2","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/vitoramaral10/flutter_cep2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitoramaral10%2Fflutter_cep2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitoramaral10%2Fflutter_cep2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitoramaral10%2Fflutter_cep2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitoramaral10%2Fflutter_cep2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitoramaral10","download_url":"https://codeload.github.com/vitoramaral10/flutter_cep2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitoramaral10%2Fflutter_cep2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29745604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["address","brazil","cep","postal-code","viacep"],"created_at":"2025-10-22T23:15:16.385Z","updated_at":"2026-02-23T14:33:39.106Z","avatar_url":"https://github.com/vitoramaral10.png","language":"Dart","readme":"# flutter_cep2\n\n[![pub package](https://img.shields.io/pub/v/flutter_cep2.svg)](https://pub.dev/packages/flutter_cep2)\n[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/vitoramaral10/flutter_cep2/blob/main/LICENSE)\n\nA Brazilian ZIP code (CEP) lookup library for Dart and Flutter applications. This package provides easy access to Brazilian postal code information using the ViaCEP API.\n\n## Features\n\n- ✅ **Easy to use**: Simple API for ZIP code lookup\n- ✅ **Multiple formats**: Support for formatted (01310-100) and unformatted (01310100) ZIP codes\n- ✅ **Output formats**: JSON and XML response formats\n- ✅ **Error handling**: Comprehensive error handling with custom exceptions\n- ✅ **Null safety**: Full null safety support\n- ✅ **Well tested**: Comprehensive test coverage\n- ✅ **Platform support**: Works on Android, iOS, Web, Windows, macOS, and Linux\n- ✅ **Documentation**: Full API documentation\n\n## Getting Started\n\n### Installation\n\nAdd this to your package's `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  flutter_cep2: ^1.0.0\n```\n\nThen run:\n\n```bash\ndart pub get\n```\n\n### Import\n\n```dart\nimport 'package:flutter_cep2/flutter_cep2.dart';\n```\n\n## Usage\n\n### Basic Usage\n\n```dart\nimport 'package:flutter_cep2/flutter_cep2.dart';\n\nFuture\u003cvoid\u003e main() async {\n  final cepService = FlutterCep2();\n  \n  try {\n    final result = await cepService.search('01310-100');\n    \n    print('CEP: ${result.cep}');\n    print('Address: ${result.logradouro}');\n    print('Neighborhood: ${result.bairro}');\n    print('City: ${result.localidade}');\n    print('State: ${result.uf}');\n  } catch (e) {\n    print('Error: $e');\n  }\n  \n  // Don't forget to dispose\n  cepService.dispose();\n}\n```\n\n### Different Input Formats\n\nThe library accepts ZIP codes in various formats:\n\n```dart\nfinal cepService = FlutterCep2();\n\n// All of these work:\nawait cepService.search('01310-100');  // Formatted\nawait cepService.search('01310100');   // Unformatted\nawait cepService.search('01.310-100'); // Alternative formatting\n```\n\n### XML Output Format\n\n```dart\nfinal result = await cepService.search(\n  '01310-100',\n  output: CepOutputFormat.xml,\n);\n```\n\n### Error Handling\n\n```dart\ntry {\n  final result = await cepService.search('00000-000');\n} on CepException catch (e) {\n  print('CEP Error: ${e.message}');\n} catch (e) {\n  print('Other error: $e');\n}\n```\n\n## API Reference\n\n### FlutterCep2\n\nMain service class for ZIP code operations.\n\n#### Constructor\n- `FlutterCep2({http.Client? client})` - Creates a new instance. Optionally accepts a custom HTTP client for testing.\n\n#### Methods\n- `Future\u003cCep\u003e search(String cep, {CepOutputFormat output = CepOutputFormat.json})` - Searches for ZIP code information\n- `void dispose()` - Closes the HTTP client\n\n### Cep\n\nModel class representing Brazilian ZIP code information.\n\n#### Properties\n- `String cep` - The ZIP code in format XXXXX-XXX\n- `String logradouro` - Street name\n- `String? complemento` - Additional address information\n- `String bairro` - Neighborhood\n- `String localidade` - City name\n- `String uf` - State abbreviation\n- `String? unidade` - Postal unit\n- `String ibge` - IBGE city code\n- `String? gia` - GIA code (São Paulo only)\n- `String? ddd` - Area code\n- `String? siaf` - SIAF code\n\n### CepOutputFormat\n\nEnum for output format options.\n\n- `CepOutputFormat.json` - JSON format (default)\n- `CepOutputFormat.xml` - XML format\n\n### CepException\n\nException thrown when there's an error with ZIP code operations.\n\n- `String message` - The error message\n\n## Examples\n\n### Flutter App Example\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:flutter_cep2/flutter_cep2.dart';\n\nclass CepLookupWidget extends StatefulWidget {\n  @override\n  _CepLookupWidgetState createState() =\u003e _CepLookupWidgetState();\n}\n\nclass _CepLookupWidgetState extends State\u003cCepLookupWidget\u003e {\n  final _cepService = FlutterCep2();\n  final _controller = TextEditingController();\n  Cep? _result;\n  String? _error;\n\n  @override\n  void dispose() {\n    _cepService.dispose();\n    _controller.dispose();\n    super.dispose();\n  }\n\n  Future\u003cvoid\u003e _searchCep() async {\n    setState(() {\n      _result = null;\n      _error = null;\n    });\n\n    try {\n      final result = await _cepService.search(_controller.text);\n      setState(() {\n        _result = result;\n      });\n    } on CepException catch (e) {\n      setState(() {\n        _error = e.message;\n      });\n    }\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Column(\n      children: [\n        TextField(\n          controller: _controller,\n          decoration: InputDecoration(\n            labelText: 'Enter CEP',\n            suffixIcon: IconButton(\n              icon: Icon(Icons.search),\n              onPressed: _searchCep,\n            ),\n          ),\n        ),\n        if (_result != null) ...[\n          Text('Address: ${_result!.logradouro}'),\n          Text('City: ${_result!.localidade} - ${_result!.uf}'),\n        ],\n        if (_error != null)\n          Text('Error: $_error', style: TextStyle(color: Colors.red)),\n      ],\n    );\n  }\n}\n```\n\n## Testing\n\nThe package includes comprehensive tests. To run them:\n\n```bash\ndart test\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for a detailed list of changes.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Credits\n\n- Uses the [ViaCEP](https://viacep.com.br/) API for ZIP code data\n- Maintained by [Vitor Amaral](https://github.com/vitoramaral10)\n\n## Support\n\nIf you have any issues or questions, please file them in the [issue tracker](https://github.com/vitoramaral10/flutter_cep2/issues).\n\n---\n\nMade with ❤️ in Brazil 🇧🇷","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitoramaral10%2Fflutter_cep2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitoramaral10%2Fflutter_cep2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitoramaral10%2Fflutter_cep2/lists"}