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 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 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(), }; } }