Metadata.parse constructor

Metadata.parse({
  1. String? testOn,
  2. Timeout? timeout,
  3. dynamic skip,
  4. bool? verboseTrace,
  5. bool? chainStackTraces,
  6. int? retry,
  7. Map<String, dynamic>? onPlatform,
  8. Object? tags,
  9. String? languageVersionComment,
})

Creates a new Metadata, but with fields parsed from caller-friendly values where applicable.

Throws a FormatException if any field is invalid.

Implementation

Metadata.parse(
    {String? testOn,
    Timeout? timeout,
    dynamic skip,
    bool? verboseTrace,
    bool? chainStackTraces,
    int? retry,
    Map<String, dynamic>? onPlatform,
    Object? /* String|Iterable<String> */ tags,
    this.languageVersionComment})
    : testOn = testOn == null
          ? PlatformSelector.all
          : PlatformSelector.parse(testOn),
      timeout = timeout ?? const Timeout.factor(1),
      _skip = skip == null ? null : skip != false,
      _verboseTrace = verboseTrace,
      _chainStackTraces = chainStackTraces,
      _retry = retry,
      skipReason = skip is String ? skip : null,
      onPlatform = _parseOnPlatform(onPlatform),
      tags = _parseTags(tags),
      forTag = const {} {
  if (skip != null && skip is! String && skip is! bool) {
    throw ArgumentError('"skip" must be a String or a bool, was "$skip".');
  }

  if (retry != null) RangeError.checkNotNegative(retry, 'retry');

  _validateTags();
}