fromJSON static method

Availability? fromJSON(
  1. Map<String, dynamic>? json
)

Creates an Availability from its JSON representation. If the availability can't be parsed, a warning will be logged with warnings.

Implementation

static Availability? fromJSON(Map<String, dynamic>? json) {
  AvailabilityState? state =
      AvailabilityState.from(json?.optNullableString("state"));
  if (state == null) {
    return null;
  }
  return Availability(
      state: state,
      since: json?.optNullableString("since")?.iso8601ToDate(),
      until: json?.optNullableString("until")?.iso8601ToDate());
}