Skip to content

Instantly share code, notes, and snippets.

@inan-mahmud
Created December 2, 2019 08:12
Show Gist options
  • Save inan-mahmud/d13545a701d388b205b2451ae7c50509 to your computer and use it in GitHub Desktop.
Save inan-mahmud/d13545a701d388b205b2451ae7c50509 to your computer and use it in GitHub Desktop.
import 'package:hub_food_park/pojos/user/result.dart';
class UserResponse {
bool status;
Result result;
UserResponse({this.status, this.result});
UserResponse.fromJson(Map<String, dynamic> json) {
status = json['status'];
result =
json['result'] != null ? new Result.fromJson(json['result']) : null;
}
bool getStatus() {
return this.status;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
if (this.result != null) {
data['result'] = this.result.toJson();
}
return data;
}
}
import 'package:hub_food_park/pojos/user/users.dart';
class Result {
String msg;
bool success;
User users;
Result({this.msg, this.success, this.users});
Result.fromJson(Map<String, dynamic> json) {
msg = json['msg'];
success = json['success'];
users = json['users'] != null ? new User.fromJson(json['users']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['msg'] = this.msg;
data['success'] = this.success;
if (this.users != null) {
data['users'] = this.users.toJson();
}
return data;
}
}
class User {
String id;
String firstName;
String lastName;
String email;
String userType;
String newPassword;
User.fromUser(this.firstName, this.lastName, this.email, this.phone,
this.password, this.userType);
String company;
String address;
String city;
String state;
String zipcode;
String phone;
String password;
User(
{this.id,
this.firstName,
this.lastName,
this.email,
this.userType,
this.company,
this.address,
this.city,
this.state,
this.zipcode,
this.phone,
this.password});
User.fromJson(Map<String, dynamic> json) {
id = json['id'];
firstName = json['first_name'];
lastName = json['last_name'];
email = json['email'];
userType = json['user_type'];
company = json['company'];
address = json['address'];
city = json['city'];
state = json['state'];
zipcode = json['zipcode'];
phone = json['phone'];
password = json['password'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['first_name'] = this.firstName;
data['last_name'] = this.lastName;
data['email'] = this.email;
data['user_type'] = this.userType;
data['company'] = this.company;
data['address'] = this.address;
data['city'] = this.city;
data['state'] = this.state;
data['zipcode'] = this.zipcode;
data['phone'] = this.phone;
data['password'] = this.password;
return data;
}
Map<String, dynamic> toUser() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['first_name'] = this.firstName;
data['last_name'] = this.lastName;
data['email'] = this.email;
data['phone'] = this.phone;
data['password'] = this.password;
data['user_type'] = this.userType;
return data;
}
Map<String, dynamic> toLoggedInUser() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['email'] = this.email;
data['password'] = this.password;
return data;
}
Map<String, dynamic> toUpdateProfileUser() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['first_name'] = this.firstName;
data['last_name'] = this.lastName;
data['email'] = this.email;
data['phone'] = this.phone;
return data;
}
User.name(this.email, this.password);
Map<String, dynamic> toUpdatePassword() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['email'] = this.email;
data['currentPassword'] = this.password;
data['newPassword'] = this.newPassword;
return data;
}
User.pass(this.id, this.email, this.password, this.newPassword);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment