diff --git a/packages/firebase_vertexai/firebase_vertexai/lib/src/imagen_content.dart b/packages/firebase_vertexai/firebase_vertexai/lib/src/imagen_content.dart index e89326e2b303..525cbeef44ed 100644 --- a/packages/firebase_vertexai/firebase_vertexai/lib/src/imagen_content.dart +++ b/packages/firebase_vertexai/firebase_vertexai/lib/src/imagen_content.dart @@ -104,7 +104,7 @@ final class ImagenGenerationResponse { /// Factory method to create an [ImagenGenerationResponse] from a JSON object. factory ImagenGenerationResponse.fromJson(Map json) { final predictions = json['predictions']; - if (predictions.isEmpty) { + if (predictions == null || predictions.isEmpty) { throw ServerException('Got empty prediction with no reason'); }