fromDynamic static method

TestReport fromDynamic(
  1. dynamic map,
  2. {String? id}
)

Implementation

static TestReport fromDynamic(
  dynamic map, {
  String? id,
}) {
  late TestReport result;
  if (map == null) {
    throw Exception('[TestReport.fromDynamic]: map is null');
  } else {
    result = TestReport._internal(
      deviceInfo: TestDeviceInfo.fromDynamic(map['deviceInfo']),
      endTime: DateTime.fromMillisecondsSinceEpoch(
        JsonClass.parseInt(map['endTime']) ?? 0,
      ),
      id: id ?? map['id'],
      images: JsonClass.fromDynamicList(
          map['images'], (map) => TestImage.fromDynamic(map)),
      logs: List<String>.from(map['logs'] ?? <String>[]),
      name: map['name'],
      runtimeException: map['runtimeException'],
      startTime: DateTime.fromMillisecondsSinceEpoch(
        JsonClass.parseInt(map['startTime']) ?? 0,
      ),
      steps: JsonClass.fromDynamicList(
        map['steps'],
        (entry) => TestReportStep.fromDynamic(entry),
      ),
      suiteName: map['suiteName'],
      version: JsonClass.parseInt(map['version']) ?? 0,
    );
  }

  return result;
}