1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/// Dart client for the [public CEP API at cep.is](https://cep.is).
///
/// Official Correios data (DNE), refreshed every two weeks. Pure Dart, so the
/// same code runs on the VM, in AOT binaries and everywhere Flutter runs,
/// Web included.
///
/// ```dart
/// import 'package:cepis/cepis.dart' as cepis;
///
/// final address = await cepis.lookup('01001-000');
/// print('${address.logradouro} ${address.localidade} ${address.uf}');
/// // Praça da Sé São Paulo SP
/// ```
///
/// Data fields keep the API's own Portuguese names; everything else — methods,
/// types, errors — is English.
library;
import 'src/client.dart';
import 'src/models.dart';
export 'src/client.dart'
show Client, defaultBaseUrl, maxBatch, normalizeCep, retriableStatus;
export 'src/errors.dart'
show
CepNotFoundException,
CepisException,
InvalidCepException,
InvalidResponseException,
NetworkException,
RateLimitedException,
ServerException;
export 'src/models.dart' show Address, Faixa, Geo, Health;
final Client _default = Client();
/// The [Client] behind the top-level [lookup], [lookupMany] and [health].
///
/// It applies process-wide, third-party packages included. Need a different
/// configuration? Build your own [Client] rather than reaching in here.
Client get defaultClient => _default;
/// Looks up a single CEP with [defaultClient]. See [Client.lookup].
Future<Address> lookup(String cep) => _default.lookup(cep);
/// Looks up many CEPs with [defaultClient]. See [Client.lookupMany].
Future<List<Address?>> lookupMany(List<String> ceps) =>
_default.lookupMany(ceps);
/// Queries the API's health with [defaultClient]. See [Client.health].
Future<Health> health() => _default.health();
|