class ApiMove { final ApiCoordinate startSquare; final ApiCoordinate endSquare; const ApiMove({ required this.startSquare, required this.endSquare, }); factory ApiMove.fromJson(Map json) { final startSquare = ApiCoordinate.fromJson(json['startSquare']); final endSquare = ApiCoordinate.fromJson(json['endSquare']); return ApiMove(startSquare: startSquare, endSquare: endSquare); } Map toJson() => {'startSquare': startSquare, 'endSquare': endSquare}; } class ApiCoordinate { final int col; final int row; const ApiCoordinate({required this.col, required this.row}); factory ApiCoordinate.fromJson(Map json) { return ApiCoordinate(col: json['col'], row: json['row']); } Map toJson() => {'col': col, 'row': row}; }