fromJson<T> static method

List<FeedbackStatus> fromJson<T>(
  1. List json
)

Implementation

static List<FeedbackStatus> fromJson<T>(List<dynamic> json) {
  if(json == null){
    return [];
  }

  return json.map((dynamic e) {
    // if(e is List)
    try {
      if(e is Map && e.isEmpty) {
        return FeedbackStatus(StatusCode.completeData, '');
      }
      if(e is Map && e['code'] is List && e['code'].isEmpty) {
        return FeedbackStatus(StatusCode.completeData, '');
      }
      return FeedbackStatus(toStatusCode(e['code']), e['message'],
        propertyName: e['propertyName']);
    }catch(err){
      print("StatusDataObject ERROR PARSING JSON=${e['code']} v=${e['message']} e=${err}");
      return FeedbackStatus(StatusCode.completeData, 'failed to parse');
    }
  }).toList();
}