Result<T>.fromJson constructor

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

Implementation

factory Result.fromJson(Map<String, dynamic> json) => switch (json[keyType]) {
      'QuestionnaireState' => Result<QuestionnaireState>.parseJson(json)
        ..result = QuestionnaireState.fromJson(
          List<Map<String, dynamic>>.from(json[keyResult] as List),
        ),
      'bool' => Result<bool>.parseJson(json)
        ..result = json[keyResult] as bool,
      _ => throw UnknownJsonTypeError(json[keyType]),
    } as Result<T>;