fromJson static method

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

Implementation

static ApiRequestMapEntity fromJson(Map<String, dynamic> json) {
  if (json['id'] == null) {
    return ApiRequestMapEntity(
      id: const Uuid().v1(),
      key: json['key'] as String,
      value: json['value'],
      immutable: json['immutable'] as bool? ?? true,
      nullable: json['nullable'] as bool? ?? false,
      type: EnumToString.fromString(
              VariableTypes.values, json['type'] as String? ?? '') ??
          VariableTypes.json,
      modelID: json['model_id'] as ID?,
    );
  }
  return ApiRequestMapEntity(
    id: json['id'] as ID,
    key: json['key'] as String,
    value: json['value'],
    immutable: json['immutable'] as bool? ?? true,
    nullable: json['nullable'] as bool? ?? false,
    type: EnumToString.fromString(
            VariableTypes.values, json['type'] as String? ?? '') ??
        VariableTypes.json,
    modelID: json['model_id'] as ID?,
  );
}