{"id":41325385,"url":"https://github.com/sgardoll/flutterflow_gemma","last_synced_at":"2026-01-23T06:03:47.222Z","repository":{"id":301277274,"uuid":"1008735003","full_name":"sgardoll/flutterflow_gemma","owner":"sgardoll","description":"A FlutterFlow library integration of the 'flutter_gemma\" pub.dev package, allowing for the easy addition of Google's Gemma 3 \u0026 3n models ;into FlutterFlow projects. This opens up local on-device AI capabilities with authenticated model downloads and real-time chat functionality.","archived":false,"fork":false,"pushed_at":"2026-01-20T21:58:04.000Z","size":27189,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-21T06:41:52.970Z","etag":null,"topics":["ai","dart","flutter","flutterflow","gemma","llm","localstorage","offline"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sgardoll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"letsbuild","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2025-06-26T02:44:32.000Z","updated_at":"2026-01-20T21:58:08.000Z","dependencies_parsed_at":"2025-12-13T21:09:16.853Z","dependency_job_id":null,"html_url":"https://github.com/sgardoll/flutterflow_gemma","commit_stats":null,"previous_names":["sgardoll/flutterflow_gemma"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sgardoll/flutterflow_gemma","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgardoll%2Fflutterflow_gemma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgardoll%2Fflutterflow_gemma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgardoll%2Fflutterflow_gemma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgardoll%2Fflutterflow_gemma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgardoll","download_url":"https://codeload.github.com/sgardoll/flutterflow_gemma/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgardoll%2Fflutterflow_gemma/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28681737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","dart","flutter","flutterflow","gemma","llm","localstorage","offline"],"created_at":"2026-01-23T06:02:38.627Z","updated_at":"2026-01-23T06:03:47.198Z","avatar_url":"https://github.com/sgardoll.png","language":"Dart","funding_links":["https://ko-fi.com/letsbuild"],"categories":[],"sub_categories":[],"readme":"# Gemma 3n FlutterFlow Integration\n\n\u003cimg width=\"1248\" height=\"832\" alt=\"MP\" src=\"https://github.com/user-attachments/assets/5246b3a6-5c57-442f-99e7-184c13ec5f08\" /\u003e\n\nAn integration of Google's Gemma 3n AI models, providing offline/local on-device multimodel AI capabilities with authenticated model downloads and real-time chat functionality.\n\n## ✨ Features\n\n### 🤖 AI Model Support\n- **Gemma 3 Text Models**: 1B parameters (text-only)\n- **Gemma 3 Nano Models**: 2B, 4B parameters (vision + text)\n- **On-device Processing**: Complete offline AI capabilities\n- **Mobile Optimized**: iOS \u0026 Android Support (Web coming soon)\n\n### 🎨 User Interface\n- **Visual Model Selector**: Expandable card interface for intuitive model selection\n- **Real-time Chat**: Interactive chat interface with typing indicators\n- **Markdown Support**: Rich text rendering for AI responses with syntax highlighting\n- **Image Processing**: Camera and gallery integration for vision models\n- **Responsive Design**: Adaptive UI that works across all screen sizes\n\n### 🚀 Performance \u0026 Storage\n- **50% Storage Reduction**: Optimized model storage prevents duplication\n- **Smart Caching**: Efficient model file management\n- **Memory Optimization**: Automatic CPU/GPU fallback for device compatibility\n- **Background Processing**: Async image processing prevents UI blocking\n\n## 🏗️ Architecture\n\n### Core Components\n\n#### GemmaManager (Singleton)\n- **Model Lifecycle**: Initialize, create sessions, send messages, cleanup\n- **Platform Compatibility**: iOS/Android-specific optimizations\n- **Error Handling**: Comprehensive fallback mechanisms\n- **Vision Support**: Automatic detection and handling of multimodal models\n\n#### Custom Widgets\n- **GemmaSimpleSetupWidget**: Complete setup wizard with progress tracking\n- **GemmaChatWidget**: Real-time chat interface with image support\n- **GemmaVisualModelSelector**: Visual model selection with expandable categories\n- **MarkdownDisplayWidget**: Rich text rendering for AI responses\n\n#### Custom Actions\n- **downloadAuthenticatedModel**: Secure model downloads with progress tracking\n- **installLocalModelFile**: Optimized model installation with validation\n- **validateAndRepairModel**: File integrity checking and repair\n- **closeModel**: Proper cleanup and state reset\n\n## 📱 Supported Models\n\n### Text-Only Models (Gemma 3)\n| Model | Parameters | Memory | Use Case |\n|-------|------------|--------|----------|\n| gemma3-1b-it | 1B | 800MB | Mobile efficiency |\n\n### Vision + Text Models (Gemma 3 Nano)\n| Model | Parameters | Memory | Capabilities |\n|-------|------------|--------|--------------|\n| gemma-3n-e2b-it | 2B | 2GB | Vision + text |\n| gemma-3n-e4b-it | 4B | 3GB | Advanced vision |\n\n## 🛠️ Installation \u0026 Setup\n\n### Prerequisites\n- Flutter SDK (stable channel)\n- FlutterFlow project setup\n- HuggingFace account with API token\n\n### Dependencies\n```yaml\ndependencies:\n  flutter_gemma: ^0.9.0\n  image_picker: ^1.1.2\n  markdown_widget: ^2.3.2+8\n  path_provider: ^2.1.4\n  url_launcher: ^6.3.1\n```\n\n### Setup Steps\n\n1. **Get HuggingFace Token**\n   - Visit [HuggingFace](https://huggingface.co/settings/tokens)\n   - Create a new token with read permissions\n   - Keep token secure for model downloads\n\n2. **Model Setup**\n   - Use the visual model selector to choose your preferred model\n   - Download will begin automatically with progress tracking\n   - Models are validated and installed locally\n\n3. **Start Chatting**\n   - Text-only models: Type messages and get AI responses\n   - Vision models: Attach images from camera or gallery\n   - Responses are rendered in rich markdown format\n\n## 🎯 Usage\n\n### Basic Chat\n```dart\n// The chat widget handles all AI interactions\nGemmaChatWidget(\n  width: double.infinity,\n  height: double.infinity,\n  placeholder: 'Ask me anything...',\n  onMessageSent: (message) async {\n    // Optional callback for message events\n  },\n)\n```\n\n### Model Selection\n```dart\n// Visual model selector with expandable categories\nGemmaVisualModelSelector(\n  selectedModelId: 'gemma-3n-e2b-it',\n  onModelSelected: (modelId) async {\n    // Handle model selection\n  },\n)\n```\n\n### Custom Actions\n```dart\n// Download and install models\nawait downloadAuthenticatedModel('gemma-3n-e2b-it', token, onProgress);\nawait installLocalModelFile(modelPath, null);\n\n// Proper cleanup\nawait closeModel();\n```\n\n## 📁 Project Structure\n\n```\nlib/\n├── custom_code/\n│   ├── actions/\n│   │   ├── download_authenticated_model.dart\n│   │   ├── install_local_model_file.dart\n│   │   ├── validate_and_repair_model.dart\n│   │   ├── close_model.dart\n│   │   └── get_downloaded_models.dart\n│   ├── widgets/\n│   │   ├── gemma_simple_setup_widget.dart\n│   │   ├── gemma_chat_widget.dart\n│   │   ├── gemma_visual_model_selector.dart\n│   │   └── markdown_display_widget.dart\n│   └── GemmaManager.dart\n├── pages/\n│   └── home_page/\n│       └── home_page_widget.dart\n└── flutter_flow/\n    └── flutter_flow_theme.dart\n```\n\n## 🔧 Development Notes\n\n### FlutterFlow Integration\n- All widgets follow FlutterFlow conventions\n- Custom actions are properly exported\n- Theme integration with FlutterFlowTheme\n- Responsive design patterns\n\n### Platform Considerations\n- **iOS**: Automatic CPU fallback for compatibility\n- **Android**: Full GPU acceleration support\n- **Web**: Optimized model variants available\n\n### Performance Optimizations\n- Image compression and resizing before processing\n- Async processing with isolates\n- Memory-efficient model loading\n- Smart caching strategies\n\n## 🐛 Troubleshooting\n\n### Common Issues\n1. **Model Not Found**: Check HuggingFace token permissions\n2. **Memory Errors**: Try CPU backend or smaller model\n3. **iOS Crashes**: Disable vision features for CPU-only devices\n4. **Storage Issues**: Use optimized model variants\n\n### Debug Tips\n- Check console logs for detailed error messages\n- Use smaller models for testing\n- Verify file permissions and storage space\n- Test on different devices for compatibility\n\n## 🤝 Contributing\n\nThis project is built for FlutterFlow integration. When contributing:\n- Follow FlutterFlow widget patterns\n- Maintain theme consistency\n- Add proper error handling\n- Update documentation\n\n## 📄 License\n\nThis project integrates with Google's Gemma models. Please review the Gemma license terms and ensure compliance with usage policies.\n\n## 🔗 Resources\n\n- [FlutterFlow Documentation](https://docs.flutterflow.io)\n- [Gemma Models](https://huggingface.co/collections/google/gemma-3-665f2f5b4b0a10a9e5d6be9d)\n- [Flutter Gemma Plugin](https://pub.dev/packages/flutter_gemma)\n- [HuggingFace Tokens](https://huggingface.co/settings/tokens)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgardoll%2Fflutterflow_gemma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgardoll%2Fflutterflow_gemma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgardoll%2Fflutterflow_gemma/lists"}