BoardState.fromJson constructor

BoardState.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory BoardState.fromJson(Map<String, dynamic> json) {
  final rows = json['rows'] as int;
  final cols = json['cols'] as int;
  final rawGrid = json['grid'] as List;
  final grid = rawGrid
      .map(
        (row) => (row as List)
            .map((c) => Cell.fromJson(c as Map<String, dynamic>))
            .toList(),
      )
      .toList();
  return BoardState(rows: rows, cols: cols, grid: grid);
}