Skip to content

Contributing

Amayyas edited this page Jul 6, 2026 · 3 revisions

Contributing

Thank you for your interest in contributing to Flutter AI SDK! This document provides guidelines for contributing.

Code of Conduct

Please be respectful and constructive in all interactions. We aim to create a welcoming environment for everyone.

Getting Started

1. Fork the Repository

  1. Fork the repository on GitHub
  2. Clone your fork locally:
    git clone https://github.com/YOUR_USERNAME/Flutter-AI-SDK.git
    cd Flutter-AI-SDK

2. Set Up Development Environment

# Install dependencies
flutter pub get

# Run tests to verify setup
flutter test

3. Create a Branch

git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix

Development Guidelines

Code Style

  • Follow the Dart Style Guide
  • Use flutter analyze to check for issues
  • Format code with dart format .

Documentation

  • Add dartdoc comments for all public APIs
  • Include code examples in documentation
  • Update wiki if adding new features

Testing

  • Write tests for new features
  • Maintain test coverage
  • Run all tests before submitting:
    flutter test

Submitting Changes

1. Commit Your Changes

Use clear, descriptive commit messages:

git commit -m "feat: add support for audio content"
git commit -m "fix: handle rate limit errors correctly"
git commit -m "docs: update streaming documentation"

Commit Message Format

  • feat: - New feature
  • fix: - Bug fix
  • docs: - Documentation only
  • test: - Adding tests
  • refactor: - Code refactoring
  • chore: - Maintenance tasks

2. Push to Your Fork

git push origin feature/your-feature-name

3. Create a Pull Request

  1. Go to the original repository
  2. Click "New Pull Request"
  3. Select your branch
  4. Fill in the PR template
  5. Submit the PR

Pull Request Guidelines

Title

Use a clear, descriptive title:

  • ✅ "Add support for Gemini 3 models"
  • ✅ "Fix streaming error handling in Anthropic provider"
  • ❌ "Update code"
  • ❌ "Fix bug"

Description

Include:

  • What changes were made
  • Why the changes were needed
  • How to test the changes
  • Any breaking changes

Checklist

  • Code follows style guidelines
  • Tests added/updated
  • Documentation updated
  • All tests pass
  • No new warnings from analyzer

Reporting Issues

Bug Reports

Include:

  1. Flutter AI SDK version
  2. Flutter version
  3. Provider being used
  4. Steps to reproduce
  5. Expected vs actual behavior
  6. Error messages/stack traces

Feature Requests

Include:

  1. Clear description of the feature
  2. Use case / motivation
  3. Proposed API (if applicable)
  4. Examples of usage

Development Tips

Running Specific Tests

# Run all tests
flutter test

# Run specific test file
flutter test test/models/content_test.dart

# Run tests with coverage
flutter test --coverage

Testing with Real APIs

For testing with actual API providers:

  1. Create a .env file (not committed):

    OPENAI_API_KEY=sk-...
    ANTHROPIC_API_KEY=sk-ant-...
    GOOGLE_AI_API_KEY=AIza...
    
  2. Run integration tests:

    flutter test test/integration/

Debugging

Enable debug logging:

import 'package:flutter_ai_sdk/flutter_ai_sdk.dart';

// Enable verbose logging
AILogger.level = LogLevel.verbose;

Project Structure

lib/
├── flutter_ai_sdk.dart      # Main export
└── src/
    ├── flutter_ai.dart      # Main class
    ├── config/              # Configuration
    ├── context/             # Context management
    ├── errors/              # Error types
    ├── models/              # Data models
    ├── providers/           # Provider implementations
    └── utils/               # Utilities

test/
├── config/                  # Config tests
├── context/                 # Context tests
├── errors/                  # Error tests
├── models/                  # Model tests
└── integration/             # Integration tests

Need Help?

Thank you for contributing! 🎉

Clone this wiki locally