fromJson static method

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

Converts json into a TestEvent.

Implementation

static TestEvent fromJson(Map<String, dynamic> json) {
  final type = json['type'] as String?;
  switch (type) {
    case 'start':
      return StartTestEvent.fromJson(json);
    case 'allSuites':
      return AllSuitesTestEvent.fromJson(json);
    case 'suite':
      return SuiteTestEvent.fromJson(json);
    case 'debug':
      return DebugTestEvent.fromJson(json);
    case 'group':
      return GroupTestEvent.fromJson(json);
    case 'testStart':
      return TestStartEvent.fromJson(json);
    case 'print':
      return MessageTestEvent.fromJson(json);
    case 'error':
      return ErrorTestEvent.fromJson(json);
    case 'testDone':
      return TestDoneEvent.fromJson(json);
    case 'done':
      return DoneTestEvent.fromJson(json);
    case 'exit':
      return ExitTestEvent.fromJson(json);
    default:
      throw UnsupportedError('Unsupported type: $type');
  }
}