Skip to content

Commit 08f55f1

Browse files
chore(example): add flutter_lints for dart analysis
This resolves the issue on jetbrains IDEs where the dart analyzer doesn't start up nor the linting, intentions and auto-complete features.
1 parent 3aab019 commit 08f55f1

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

example/analysis_options.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/lints.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26+
27+
# Additional information about this file can be found at
28+
# https://dart.dev/guides/language/analysis-options

example/pubspec.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ packages:
7575
description: flutter
7676
source: sdk
7777
version: "0.0.0"
78+
flutter_lints:
79+
dependency: "direct dev"
80+
description:
81+
name: flutter_lints
82+
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
83+
url: "https://pub.dev"
84+
source: hosted
85+
version: "2.0.3"
7886
flutter_test:
7987
dependency: "direct dev"
8088
description: flutter
@@ -92,6 +100,14 @@ packages:
92100
relative: true
93101
source: path
94102
version: "12.5.0"
103+
lints:
104+
dependency: transitive
105+
description:
106+
name: lints
107+
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
108+
url: "https://pub.dev"
109+
source: hosted
110+
version: "2.1.1"
95111
matcher:
96112
dependency: transitive
97113
description:

example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dev_dependencies:
3232
sdk: flutter
3333
flutter_test:
3434
sdk: flutter
35+
flutter_lints: ^2.0.0
3536

3637
# For information on the generic Dart part of this file, see the
3738
# following page: https://dart.dev/tools/pub/pubspec

0 commit comments

Comments
 (0)