You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.5 KiB
66 lines
1.5 KiB
import 'package:flutter/cupertino.dart'; |
|
|
|
class UserModel { |
|
String? id; |
|
String? username; |
|
String? fullname; |
|
String? email; |
|
String? nip; |
|
String? no_hp; |
|
String? jenis_kelamin; |
|
String? address; |
|
String? password; |
|
int? role_id; |
|
int? warehouse_id; |
|
String? token; |
|
|
|
UserModel({ |
|
this.id, |
|
this.username, |
|
this.fullname, |
|
this.email, |
|
this.nip, |
|
this.no_hp, |
|
this.jenis_kelamin, |
|
this.address, |
|
this.password, |
|
this.role_id, |
|
this.warehouse_id, |
|
this.token, |
|
}); |
|
|
|
UserModel.fromJson(Map<String, dynamic> json) { |
|
id = json['id'].toString(); |
|
username = json['username']; |
|
fullname = json['fullname']; |
|
email = json['email']; |
|
nip = json['nip']; |
|
no_hp = json['no_hp']; |
|
jenis_kelamin = json['jenis_kelamin']; |
|
address = json['address']; |
|
password = json['password']; |
|
role_id = |
|
json['role_id'] != null ? int.parse(json['role_id'].toString()) : null; |
|
warehouse_id = json['warehouse_id'] != null |
|
? int.parse(json['warehouse_id'].toString()) |
|
: null; |
|
token = json['token'].toString(); |
|
} |
|
|
|
Map<String, dynamic> toJson() { |
|
return { |
|
'id': id.toString(), |
|
'username': username, |
|
'email': email, |
|
'fullname': fullname, |
|
'nip': nip, |
|
'no_hp': no_hp, |
|
'jenis_kelamin': jenis_kelamin, |
|
'address': address, |
|
'password': password, |
|
'role_id': role_id.toString(), |
|
'warehouse_id': warehouse_id.toString(), |
|
'token': token.toString(), |
|
}; |
|
} |
|
}
|
|
|