loadEmployee method

Future loadEmployee()

Implementation

Future<Employee> loadEmployee() async {
    final prefs = await SharedPreferences.getInstance();
    final raw = prefs.getString('current_employee');
    if (raw == null) {

      return Employee(employeeId: "", name: "");
    }
    final map = json.decode(raw);

    final Employee employee = Employee(employeeId: "employeeId",
        email: map['email'] ?? '',
        image: map['image'] ?? '',
        bu: map['bu'] ?? '',
        positionName: map['position_name'] ?? '',
        id: int.tryParse(map['icEmployeeId'].toString()) ?? 0,
        name:  map['name'] ?? '');


    return employee;
  }