fromJson static method

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

Implementation

static QueryEntity fromJson(Map<String, dynamic> json) {
  if (json['query_type'] == 'api') {
    return APIRequestEntity.fromJson(json);
  } else if (json['query_type'] == 'supabase') {
    return SupabaseQuery.fromJson(json);
  } else {
    try {
      return APIRequestEntity.fromJson(json);
    } catch (e) {
      throw Exception('Unknown query type');
    }
  }
}