HintStep.fromJson constructor

HintStep.fromJson(
  1. Map<String, dynamic> json, {
  2. void onWarning(
    1. String warning
    )?,
})

Implementation

factory HintStep.fromJson(
  Map<String, dynamic> json, {
  void Function(String warning)? onWarning,
}) =>
    HintStep(
      targetId: json['targetId'] as String,
      moreTargets: (json['moreTargets'] as List?)?.cast<String>() ?? const [],
      moreTooltips: (json['moreTooltips'] as List?)
              ?.map((e) => HintTooltip.fromJson(
                    e as Map<String, dynamic>,
                    onWarning: onWarning,
                  ))
              .toList() ??
          const [],
      title: json['title'] as String?,
      description: json['description'] as String?,
      position: _enumOrDefault(TooltipPosition.values, json['position'],
          TooltipPosition.auto, field: 'position', onWarning: onWarning),
      waitTimeout: json['waitTimeoutMs'] == null ? null : Duration(milliseconds: json['waitTimeoutMs'] as int),
      showSkip: json['showSkip'] as bool? ?? true,
      missingTargetPolicy: _enumOrNull(HintMissingTargetPolicy.values,
          json['missingTargetPolicy'],
          field: 'missingTargetPolicy',
          onWarning: onWarning),
      tapOnTarget: json['tapOnTarget'] as bool? ?? true,
      tapOnOverlay: json['tapOnOverlay'] as bool? ?? true,
      focusShape: _enumOrNull(FocusShape.values, json['focusShape'],
          field: 'focusShape', onWarning: onWarning),
      focusPadding: (json['focusPadding'] as num?)?.toDouble(),
      autoScroll: json['autoScroll'] as bool?,
      transitionDuration: json['transitionDurationMs'] == null ? null : Duration(milliseconds: json['transitionDurationMs'] as int),
      transitionCurve: _enumOrNull(HintCurve.values, json['transitionCurve'],
          field: 'transitionCurve', onWarning: onWarning),
      targetRect: json['targetRect'] == null
          ? null
          : Rect.fromLTWH((json['targetRect']['left'] as num).toDouble(), (json['targetRect']['top'] as num).toDouble(), (json['targetRect']['width'] as num).toDouble(), (json['targetRect']['height'] as num).toDouble()),
    );