请求与返回实体类 protocol
class LoginReq {
String username;
String password;
LoginReq(this.username, this.password);
-
LoginReq.fromJson(Map<String, dynamic> json)
-
username = json[‘username’],
password = json[‘password’];
Map<String, dynamic> toJson() => {
‘username’: username,
‘password’: password,
};
@override
String toString() {
StringBuffer sb = new StringBuffer(‘{’);
sb.write("“username”:“ u s e r n a m e " ¨ ) ; s b . w r i t e ( " , p ¨ a s s w o r d : ¨ username\""); sb.write(",\"password\": username