我在我的应用程序中使用 Flutter INTL 包进行国际化。该包生成一个generated
文件夹,我希望分析器忽略它。
我遵循了从分析文章中排除代码但是,它似乎不起作用,因为生成的两个文件不会从列表中消失。
这是我的 pubspec.yaml 文件。
name: luma_app
description: Luma My Account
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
# Firebase related libraries
firebase_core: ^0.5.3 # https://pub.dev/packages/firebase_core
firebase_crashlytics: ^0.2.4 # https://pub.dev/packages/firebase_crashlytics
firebase_analytics: ^6.3.0 # https://pub.dev/packages/firebase_analytics
firebase_auth: ^0.18.4+1 # https://pub.dev/packages/firebase_auth
cloud_firestore: ^0.14.4 # https://pub.dev/packages/cloud_firestore
firebase_storage: ^5.2.0 # https://pub.dev/packages/firebase_storage
# Internationalization package helps us to manage different languages
intl: ^0.16.1 # https://pub.dev/packages/intl
provider: ^4.3.2+3 # https://pub.dev/packages/provider
google_fonts: ^1.1.1 # https://pub.dev/packages/google_fonts
package_info: ^0.4.3+2 # https://pub.dev/packages/package_info/install
shared_preferences: ^0.5.12+4 # https://pub.dev/packages/shared_preferences
get_it: ^5.0.3 # https://pub.dev/packages/get_it
flutter_svg: ^0.19.1 # https://pub.dev/packages/flutter_svg
native_pdf_view: ^3.9.0 # https://pub.dev/packages/native_pdf_view
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.9.2 # https://pub.dev/packages/pedantic
# effective_dart: ^1.3.0 # https://pub.dev/packages/effective_dart
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
generate: true # This is for localizations. Don't remove it.
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/google_fonts/
- assets/images/
flutter_intl:
enabled: true
最后,这是我的 analysis_options.yaml 文件的内容。
# For more information visit:
# https://dart.dev/guides/language/analysis-options
#include: package:pedantic/analysis_options.yaml
# or
include: package:pedantic/analysis_options.1.9.0.yaml
#include: package:effective_dart/analysis_options.1.3.0.yaml
analyzer:
exclude:
- lib/generated/**
# strong-mode:
# implicit-casts: false
# implicit-dynamic: false
# errors:
# prefer_single_quotes: ignore
linter:
rules:
- camel_case_types
Dart/OS 版本:
==> dart --version
Dart SDK version: 2.10.4 (stable) (Wed Nov 11 13:35:58 2020 +0100) on "macos_x64"