Map<String, Object?> toJson() => <String, Object?>{ 'name': name, 'ok': ok, if (detail != null) 'detail': detail, };