Map<String, dynamic> toJson() => { 'environmentState': environmentState, if (workspaceDiff != null) 'workspaceDiff': workspaceDiff!.toJson(), };