GherkinTable.fromJson constructor

GherkinTable.fromJson(
  1. String json
)

Implementation

factory GherkinTable.fromJson(String json) {
  final data = (jsonDecode(json) as List<dynamic>)
      .map((x) => x as Map<String, dynamic>);
  final headerRow = data.isNotEmpty
      ? TableRow(data.first.keys, 1, isHeaderRow: true)
      : null;
  final rows = data
      .map((x) => TableRow(x.values.cast<String>(), 1, isHeaderRow: false));
  final table = GherkinTable(rows, headerRow);

  return table;
}