Skip to content

Instantly share code, notes, and snippets.

@kleberandrade
Created September 11, 2019 20:09
Show Gist options
  • Save kleberandrade/1c4008321e320e86a0adca32845e9f7e to your computer and use it in GitHub Desktop.
Save kleberandrade/1c4008321e320e86a0adca32845e9f7e to your computer and use it in GitHub Desktop.
import 'dart:convert';
class ResultCep {
String cep;
String logradouro;
String complemento;
String bairro;
String localidade;
String uf;
String unidade;
String ibge;
String gia;
ResultCep({
this.cep,
this.logradouro,
this.complemento,
this.bairro,
this.localidade,
this.uf,
this.unidade,
this.ibge,
this.gia,
});
factory ResultCep.fromJson(String str) => ResultCep.fromMap(json.decode(str));
String toJson() => json.encode(toMap());
factory ResultCep.fromMap(Map<String, dynamic> json) => ResultCep(
cep: json["cep"],
logradouro: json["logradouro"],
complemento: json["complemento"],
bairro: json["bairro"],
localidade: json["localidade"],
uf: json["uf"],
unidade: json["unidade"],
ibge: json["ibge"],
gia: json["gia"],
);
Map<String, dynamic> toMap() => {
"cep": cep,
"logradouro": logradouro,
"complemento": complemento,
"bairro": bairro,
"localidade": localidade,
"uf": uf,
"unidade": unidade,
"ibge": ibge,
"gia": gia,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment