fromJsonString static method

DartTestEvent? fromJsonString(
  1. String jsonString
)

Implementation

static DartTestEvent? fromJsonString(String jsonString) {
  final json = jsonDecode(jsonString);
  if (json == null || json['type'] == null || json['time'] == null) {
    return null;
  }

  final type = json['type'];
  switch (type) {
    case DartTestStartEvent.thisType:
      return DartTestStartEvent.fromJson(json);

    case DartTestAllSuitesEvent.thisType:
      return DartTestAllSuitesEvent.fromJson(json);

    case DartTestSuiteEvent.thisType:
      return DartTestSuiteEvent.fromJson(json);

    case DartTestDebugEvent.thisType:
      return DartTestDebugEvent.fromJson(json);

    case DartTestGroupEvent.thisType:
      return DartTestGroupEvent.fromJson(json);

    case DartTestTestStartEvent.thisType:
      return DartTestTestStartEvent.fromJson(json);

    case DartTestMessageEvent.thisType:
      return DartTestMessageEvent.fromJson(json);

    case DartTestErrorEvent.thisType:
      return DartTestErrorEvent.fromJson(json);

    case DartTestTestDoneEvent.thisType:
      return DartTestTestDoneEvent.fromJson(json);

    case DartTestDoneEvent.thisType:
      return DartTestDoneEvent.fromJson(json);

    default:
      return null;
  }
}