Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter analyze works on local but fails in github actions

Im using lint in my flutter project and i applied some rules in my analysis_options.yaml that works on local as i expected, but when my workflow on github actions is excecuted (with the same exact code) flutter analyze fails and show me 2 new problems like this one:

 "info • Prefer const over final for declarations • lib/data/remote/user_api_provider.dart:146:7 • prefer_const_declarations
"

on local "flutter analyze" it cant detect it.

im very confused, i cant find information on google i dont know how to solve this.

Im using Flutter 2.2.2 stable and dart 2.13.3 stable.

Edit: This is my workflow

name: Lint-Analyze

on:  
  pull_request:
    branches:
      - develop
jobs:
  flutter_analyze:
    name: Run flutter analyze
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with:
          java-version: "12.x"
      - uses: subosito/flutter-action@v1
        with:
          flutter-version: '2.2.2'
          channel: 'stable'

      - run: flutter pub get
      - run: flutter analyze
  
like image 423
Rodrigo porras Avatar asked Oct 26 '25 14:10

Rodrigo porras


1 Answers

I think your Flutter version in the GitHub action is not on the same version you use locally.

Please check your workflow file for something like this:

  with: flutter-version: '2.0.5'

And run flutter doctor on your local machine to check if the versions are really the same. If not, just change the version of your GitHub action.

Hope that's fixes your issue :)

like image 177
LeptonByte Avatar answered Oct 29 '25 04:10

LeptonByte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!