46

I have a flutter package that uses effective_dart which is working as expected. (I've explicitly tested this by adding/removing the include and ensure that warnings come and go as expected.)

I have the effective_dart dependency in my pubspec.yaml as follows:

name: sounds
version: 0.9.1

repository: https://github.com/bsutton/sounds
homepage: https://github.com/bsutton/sounds
documentation: https://github.com/bsutton/sounds/wiki
description: Sounds provide a complete api and Widgets for audio playback and recording. Both iOS and Android are supported.
environment: 
  sdk: '>=2.1.0 <3.0.0'
  flutter: '>=1.17.0 <2.0.0'
dependencies: 
  device_info: '>=0.4.2+4 <2.0.0'
  flutter_spinkit: ^4.0.0
  meta: ^1.1.8
  path: ^1.6.4
  path_provider: ^1.6.7
  provider: ^4.1.0
  sounds_common: ^1.0.1
  uuid: ^2.0.4
  flutter: 
    sdk: flutter
dev_dependencies: 
  pedantic: ^1.9.0
  effective_dart: ^1.2.1
  dshell: ^1.0.0
  e2e: ^0.5.0
  lint: ^1.1.1
  pub_semver: ^1.4.4
  flutter_test: 
    sdk: flutter
  flutter_driver: 
    sdk: flutter
flutter: 
  plugin: 
    platforms: 
      android: 
        package: com.bsutton.sounds
        pluginClass: Sounds
      ios: 
        pluginClass: Sounds

The analysis_options.yaml contains:

include: package:effective_dart/analysis_options.yaml

    
analyzer:
  errors:
    todo: ignore
  
  strong-mode:
    implicit-casts: false
    implicit-dynamic: false
    

The problem is that I keep getting a warning about the include not being found. If I make a trivial edit (add a commented out blank line) to the analysis_options.yaml file the error goes away for a while but invariably returns (generally after a restart of the ide).

I'm using vs code but believe I've seen it in android studio (although I can't reproduce it now).

The error:

The include file package:effective_dart/analysis_options.yaml in /home/bsutton/git/sounds/analysis_options.yaml cannot be found.

The problem is having no material impact on my project but its just really annoying to have a warning always showing up.

julemand101
  • 28,470
  • 5
  • 52
  • 48
Brett Sutton
  • 3,900
  • 2
  • 28
  • 53

5 Answers5

65

Using the command given below is worked for me. Let you try it in the terminal.

flutter pub add --dev flutter_lints

(restart VSCode if the warning is still shown)

SwiftiSwift
  • 7,528
  • 9
  • 56
  • 96
Ahmad Iqbal Bhatti
  • 707
  • 1
  • 5
  • 8
16

This seems to be a problem with sub projects (your example folder). See https://github.com/dart-lang/sdk/issues/42910

You can try to exclude the example in your root analysis_options.yaml:

analyzer:
  exclude:
    # workaround for https://github.com/dart-lang/sdk/issues/42910
    - 'example/**'

And then add a separate analysis_options.yaml to the example.

kuhnroyal
  • 7,188
  • 1
  • 34
  • 47
14

If someone is still looking for the answer for the same error, this worked for me. I have added flutter_lints: ^1.0.4 in dependencies in pubspec.yml file. And the error gone.

Shabbir
  • 289
  • 2
  • 6
5

you can try this command

flutter pub add --dev flutter_lints

if didn't work use this command

flutter pub upgrade flutter_lints
Hassan Al Najjar
  • 324
  • 1
  • 4
  • 13
-1

Solution that works for me:

  1. Add hashtag # in front of it.
  2. Add flutter_lints: ^1.0.4 package in pubspec.yaml file.