parse static method

List<StepModel> parse(
  1. dynamic schema, {
  2. String? locale,
})

Implementation

static List<StepModel> parse(dynamic schema, {String? locale}) {
  Map<String, dynamic> json;
  if (schema is String) {
    json = jsonDecode(schema);
  } else if (schema is Map<String, dynamic>) {
    json = schema;
  } else {
    throw ArgumentError('Schema must be a JSON string or Map');
  }
  final steps = (json['steps'] as List?) ?? [json];
  return steps.map((step) => StepModel.fromJson(step, locale: locale)).toList();
}