fromDynamic static method

CompareGoldenImageStep fromDynamic(
  1. dynamic map
)

Creates an instance from a JSON-like map structure. This expects the following format:

{
  "allowedDelta": <double>,
  "failWhenGoldenMissing": <bool>,
  "imageId": <String>,
  "imageOnFail": <String>
}

See also:

  • JsonClass.parseDurationFromSeconds
  • ThemeDecoder.decodeColor

Implementation

static CompareGoldenImageStep fromDynamic(dynamic map) {
  CompareGoldenImageStep result;

  if (map == null) {
    throw Exception('[CompareGoldenImageStep.fromDynamic]: map is null');
  } else {
    result = CompareGoldenImageStep(
      allowedDelta: JsonClass.parseDouble(map['allowedDelta']),
      failWhenGoldenMissing: map['failWhenGoldenMissing'] == null
          ? true
          : JsonClass.parseBool(map['failWhenGoldenMissing']),
      imageId: map['imageId'],
      imageOnFail: map['imageOnFail'],
    );
  }

  return result;
}