StatusResponse.fromJson constructor

StatusResponse.fromJson(
  1. Map<String, dynamic> json
)

Creates a StatusResponse from a JSON object.

Implementation

factory StatusResponse.fromJson(Map<String, dynamic> json) {
  return StatusResponse(
    status: Status.values.firstWhere((e) => e.code == json['status']),
    message: json['message'],
    dataUpdated: json.containsKey('data_updated')
        ? DateTime.parse(json['data_updated'])
        : null,
    softwareVersion: json['software_version'],
    databaseVersion: json['database_version'],
  );
}