fromJson method

Weekday fromJson (dynamic json)

Converts JSON into a Weekday. Errors if given JSON representation is invalid.

Implementation

static Weekday fromJson(dynamic json) {
  switch (json) {
    case 0:
      return Weekday.Monday;
      break;

    case 1:
      return Weekday.Tuesday;
      break;

    case 2:
      return Weekday.Wednesday;
      break;

    case 3:
      return Weekday.Thursday;
      break;

    case 4:
      return Weekday.Friday;
      break;

    default:
      throw 'Invalid JSON representation!';
  }
}