name: Flutter Analyze

# This workflow runs flutter analyze to check for code issues.

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]
  workflow_dispatch:

env:
  FLUTTER_VERSION: '3.35.6'

jobs:
  analyze:
    name: Flutter Analyze
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup Flutter
        uses: subosito/flutter-action@v2
        with:
          flutter-version: ${{ env.FLUTTER_VERSION }}
          channel: 'stable'
          cache: true

      - name: Install dependencies
        run: flutter pub get

      - name: Generate localizations
        run: flutter gen-l10n

      - name: Run flutter analyze
        run: flutter analyze
