Created
September 11, 2019 20:09
-
-
Save kleberandrade/1c4008321e320e86a0adca32845e9f7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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