analysis_options.yaml: the URI it includes can't be found
The URI 'package:flutter_lints/flutter.yaml' included in '/path/analysis_options.yaml' can't be found when analyzing '/path'.Short answer
The analyzer reports include_file_not_found when the file named after include: in analysis_options.yaml does not resolve. For a package: include, the package must be a dev dependency and be downloaded. Add it with flutter pub add dev:flutter_lints, run pub get, and use the exact include line from the package page.
Fix it fast
1Find out which cause you have
Print the include line and look for the package in the project files.
grep -n 'include' analysis_options.yaml grep -n lints pubspec.yaml pubspec.lock2Match what you see, then jump to its fix
What does the error look like?
The URI 'package:flutter_lints/flutter.yaml' included in '/path/analysis_options.yaml' can't be found when analyzing '/path'.include_file_not_found
Cause 1 of 2
The lint package is not a dependency yet, or pub get was not run
1Check
A package: URI can only be resolved when the package is in the project's dependencies and has been fetched. The Dart analysis docs tell you to add the lints package as a dev dependency before including its rule set. Older projects often have the include line but no matching entry in dev_dependencies.
grep -n -A6 'dev_dependencies' pubspec.yaml2Fix
Add the package as a dev dependency, which also runs pub get.
flutter pub add dev:flutter_lints3Verify
Restart the analysis server in your editor, or analyze from the terminal.
flutter analyzeConfirmed by pub.dev
Cause 2 of 2
The include line names a file the package does not have
1Check
Each package documents its own file names. flutter_lints is included as package:flutter_lints/flutter.yaml, and the plain lints package offers core and recommended rule sets. Copying a line from a tutorial for the other package leaves a path that does not exist.
grep -n 'include' analysis_options.yaml2Fix
Replace the include line with the one printed on the package's own page. Include several files as a list if you want to.
# analysis_options.yaml
include: package:flutter_lints/flutter.yaml
# or, with the lints package
# include: package:lints/recommended.yaml3Verify
Analyze again. The warning on the first line of the file disappears.
flutter analyzeConfirmed by dart.dev
How do I stop it coming back?
- Add the lint package and the include line in the same commit.
- Run flutter pub get after cloning a project and after switching branches.
- When you copy an analysis_options.yaml from another repo, copy its dev_dependencies too.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- Qist BazaarA buy-now-pay-later marketplace built from a blank repo, now past 100K downloads on Google Play.
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
Related fixes
Mobile apps
AudioCache has no play method after updating audioplayers
The method 'play' isn't defined for the type 'AudioCache'.
Since audioplayers 1.0, AudioCache only turns asset files into local files and caches them.
2 causes, each with a fixMobile apps
Flutter Bloc throws that emit was called after the event handler completed
emit was called after an event handler completed normally.
Each on<Event> handler gets its own Emitter, and it stops working the moment the handler's returned Future completes.
2 causes, each with a fixMobile apps
Dart error: the body might complete normally and return null for a non-nullable type
body_might_complete_normally
Dart found a path through your function or callback that reaches the closing brace without a return.
3 causes, each with a fixMobile apps
Dart throws ConcurrentModificationError while looping over a list
ConcurrentModificationError
Dart throws this when a collection changes size while something iterates it.
2 causes, each with a fixMobile apps
Dart cannot turn a compact timestamp like 20201101153000 into a DateTime
FormatException: Invalid date format
DateTime.parse accepts a subset of ISO 8601, and a time part must be introduced by T or a space.
2 causes, each with a fixMobile apps
FormatException: Invalid radix-10 number when parsing a string to int
FormatException: Invalid radix-10 number
int.parse accepts only a whole-number literal.
3 causes, each with a fix