flutter_gemma library

Classes

CanceledError
Download canceled
CancelToken
Token for cancelling model downloads
Condition
A single predicate over one metadata field. Sealed because the storage codec needs to switch over the concrete subtype — adding a new condition without updating the codec would silently drop it.
CorruptionDetectionResult
Result of corruption detection
DiagnosticReport
Diagnostic information for troubleshooting
DocumentWithEmbedding
Document with its embedding, used to rebuild an in-memory HNSW index.
DownloadError
Download error types using sealed classes for exhaustive pattern matching
DownloadProgress
Progress information for model downloads
EmbeddingInstallation
Result of embedding model installation
EmbeddingInstallationBuilder
Fluent builder for embedding model installation
EmbeddingModel
Represents an embedding model instance.
EmbeddingModelSpec
Specification for embedding models (model.bin + tokenizer.json)
ErrorHandlingResult
Result of error handling
EstimatedDimensions
Estimated image dimensions
FieldEquals
metadata[key] == value exact match.
FieldMatchAny
metadata[key] in values set membership. Equivalent to N FieldEquals wrapped in a should bucket, but expressed in one place and serialized more efficiently on the storage side.
FieldRange
gte <= metadata[key] <= lte numeric range. Either bound may be null for one-sided ranges (e.g. gte: 10 matches anything >= 10).
Filter
Payload filter applied alongside vector similarity search.
FilterField
A single metadata field a store is told to make filterable.
FilterSchema
The set of metadata fields a store should make filterable.
FlutterGemma
Modern API facade for Flutter Gemma
FlutterGemmaDesktop
Desktop implementation of FlutterGemma plugin
FlutterGemmaPlugin
Interface for the FlutterGemma plugin.
ForbiddenError
HTTP 403 - Access forbidden
FunctionCallParser
Facade for backward compatibility. Delegates to model-specific FunctionCallFormat implementations.
FunctionCallResponse
Gemma3Specs
Gemma 3 SigLIP vision encoder specifications
GeneralVisionSpecs
General vision encoder specifications
ImageErrorHandler
Comprehensive error handling and debugging utilities for AI image processing to prevent corruption that causes repeating text patterns in model responses.
ImageProcessor
Comprehensive image processing utilities to prevent AI image corruption and ensure proper vision encoder compatibility.
ImageTokenizer
Handles proper image tokenization for multimodal AI models to prevent "Prompt contained 0 image tokens but received 1 images" errors and corruption that causes repeating text patterns.
InferenceChat
InferenceInstallation
Result of inference model installation
InferenceInstallationBuilder
Fluent builder for inference model installation
InferenceModel
Represents an LLM model instance.
InferenceModelSession
Session managing response generation from the model.
InferenceModelSpec
Specification for inference models (main model + optional LoRA)
Message
ModelFile
Represents a single file that belongs to a model
ModelFileManager
ModelResponse
Base interface for model responses from InferenceChat Can be either TextResponse, FunctionCallResponse, or ThinkingResponse
ModelSpec
Base specification for any model (inference or embedding)
MultimodalImageHandler
Main integration class for handling multimodal image processing in Flutter Gemma to prevent AI image corruption and repeating text pattern issues.
MultimodalImageResult
Result of multimodal image processing
NetworkError
Network connectivity error
NotFoundError
HTTP 404 - Resource not found
OrphanedFileInfo
Information about a potentially orphaned file
ParallelFunctionCallResponse
Multiple function calls in a single model response.
ProcessedImage
Represents a processed image ready for AI model consumption
RateLimitedError
HTTP 429 - Rate limit exceeded
ResponseValidationResult
Result of response validation
RetrievalResult
A single retrieval hit from a vector store query.
ServerError
HTTP 5xx - Server error
SessionMetrics
Session metrics containing token usage and performance statistics.
SkillExecutorProvider
A pluggable skill executor — the seam between core and the opt-in flutter_gemma_agent package's agentic "skills" runtime.
SkillExecutorRegistry
Holds skill executors registered via FlutterGemma.initialize (skillExecutors:). Same probe-chain selection as EngineRegistry / EmbeddingRegistry: the registered executor with the highest SkillExecutorProvider.priority whose SkillExecutorProvider.canExecute returns true for a skill type wins (first-registered breaks ties). There is no central type map — the opt-in flutter_gemma_agent executors self-select.
StopTokenFilter
Filters stop tokens from model response stream. For .litertlm on iOS, MediaPipe doesn't handle <end_of_turn> — this filter detects and terminates the stream at the stop token, with buffering for partial tag matches.
StorageStats
Storage statistics
TextResponse
Text token during streaming
ThinkingResponse
Thinking process content from the model
Tool
UnauthorizedError
HTTP 401 - Authentication required
UnknownError
Unknown error
ValidationResult
Result of image validation
VectorStoreRepository
Abstract repository for vector store operations
VectorStoreStats
Summary statistics for a vector store.
VisionEncoderValidator
Validates images for compatibility with AI vision encoders to prevent corruption that causes models to interpret images as repeating text patterns.
VisionSpecs
Base class for vision encoder specifications

Enums

CorruptionAction
Actions to take when corruption is detected
ErrorType
Types of errors that can occur in image processing
FilterFieldType
The storage type of a declared filterable metadata field.
GemmaLogLevel
Verbosity for flutter_gemma's internal logs.
MessageType
ModelFileType
ModelManagementType
Base enumeration for different model management types
ModelReplacePolicy
Policy for what happens to a previously-installed model when a new one is set active. Lives with the spec value types (it's a per-spec install policy); re-exported from model_file_manager_interface.dart for backward compat.
ModelType
PreferredBackend
Hardware backend for model inference.
ResponseAction
Actions to take for corrupted responses
TaskType
Task type for embedding generation, following Google RAG SDK convention.
ToolChoice
Controls whether the model should call tools.
VisionEncoderType
Vision encoder types with their specifications
WebStorageMode
Storage mode for web platform models

Mixins

RawSdkResponseSession
Mixin for sessions that surface the SDK's structured raw JSON response (LiteRT-LM Gemma 4 path with tool_calls). Allows InferenceChat to read the structured tool calls without a hard dependency on a concrete session type, and lets non-FFI sessions opt out by simply not implementing this mixin.

Extensions

DownloadErrorMessage on DownloadError
Extension to convert DownloadError to user-friendly messages

Constants

defaultMaxFunctionBufferLength → const int
Default maximum length for function call buffer before flushing as text. Must accommodate verbose formats (DeepSeek tags, parallel calls).
supportedLoraRanks → const List<int>

Properties

isDesktop bool
Check if current platform is desktop
no setter

Exceptions / Errors

DownloadCancelledException
Exception thrown when a download is cancelled
DownloadException
Custom exception for download failures
ImageProcessingException
Exception thrown when image processing fails
ImageTokenizationException
Exception thrown when image tokenization fails
ModelStorageException
Exception thrown when model storage operations fail
VectorStoreException
Exception thrown by VectorStore operations
VisionEncoderValidationException
Exception thrown when validation fails