body method

  1. @override
String body(
  1. String path,
  2. String baseName,
  3. String className
)
override

Defines the actual body code. path is passed relative to lib, baseName is the filename, and className is the filename converted to Pascal case.

実際の本体コードを定義します。pathlibからの相対パス、baseNameにファイル名が渡され、classNameにファイル名をパスカルケースに変換した値が渡されます。

Implementation

@override
String body(String path, String baseName, String className) {
  return r"""
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
  prefer_double_quotes: true
  prefer_asserts_with_message: true
  cancel_subscriptions: true
  prefer_const_constructors: true
  always_put_control_body_on_new_line: true
  prefer_if_elements_to_conditional_expressions: true
  always_put_required_named_parameters_first: true
  avoid_equals_and_hash_code_on_mutable_classes: true
  use_if_null_to_convert_nulls_to_bools: true
  missing_whitespace_between_adjacent_strings: true
  leading_newlines_in_multiline_strings: true
  deprecated_member_use_from_same_package: true
  close_sinks: true
  avoid_print: true
  no_duplicate_case_values: true
  do_not_use_environment: true
  library_names: true
  matching_super_parameters: true
  no_literal_bool_comparisons: true
  omit_obvious_local_variable_types: true
  type_annotate_public_apis: true
  package_prefixed_library_names: true
  prefer_mixin: true
  prefer_void_to_null: true
  unnecessary_lambdas: true
  unnecessary_async: true
  use_decorated_box: true
  use_colored_box: true
  sized_box_shrink_expand: true
  unnecessary_null_aware_operator_on_extension_on_nullable: true
  prefer_is_not_operator: true
  prefer_iterable_whereType: true
  exhaustive_cases: true
  prefer_asserts_in_initializer_lists: true
  prefer_conditional_assignment: true
  prefer_const_constructors_in_immutables: true
  prefer_const_declarations: true
  prefer_const_literals_to_create_immutables: true
  prefer_constructors_over_static_methods: true
  prefer_contains: true
  public_member_api_docs: true
  no_default_cases: false
  library_private_types_in_public_api: false
  use_build_context_synchronously: false

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

# Set to exclude json_serializable files.
# json_serializableのファイルを除外するための設定。
analyzer:
plugins:
  - custom_lint
exclude:
  - "**/*.g.dart"
  - "**/*.freezed.dart"
  - "**/*.theme.dart"
  - "**/*.localize.dart"
  - "**/*.listenable.dart"
  - "**/*.page.dart"
  - "**/*.router.dart"
  - "**/*.prefs.dart"
  - "**/*.m.dart"
  - "**/*.model.dart"
  - "lib/dataconnect/**"
  - "lib/firebase_options.dart"
errors:
  prefer_double_quotes: error
  always_put_control_body_on_new_line: error
  prefer_asserts_with_message: error
  leading_newlines_in_multiline_strings: error
  use_if_null_to_convert_nulls_to_bools: error
  missing_whitespace_between_adjacent_strings: error
  prefer_if_elements_to_conditional_expressions: error
  do_not_use_environment: error
  avoid_print: error
  library_names: error
  prefer_mixin: error
  prefer_void_to_null: error
  exhaustive_cases: error
  prefer_asserts_in_initializer_lists: error
  deprecated_member_use_from_same_package: warning
  close_sinks: warning
  no_duplicate_case_values: warning
  matching_super_parameters: warning
  no_literal_bool_comparisons: warning
  omit_obvious_local_variable_types: warning
  type_annotate_public_apis: warning
  package_prefixed_library_names: warning
  unnecessary_lambdas: warning
  unnecessary_async: warning
  use_decorated_box: warning
  use_colored_box: warning
  sized_box_shrink_expand: warning
  unnecessary_null_aware_operator_on_extension_on_nullable: warning
  prefer_is_not_operator: warning
  prefer_iterable_whereType: warning
  prefer_conditional_assignment: warning
  prefer_const_constructors_in_immutables: warning
  prefer_const_declarations: warning
  prefer_const_literals_to_create_immutables: warning
  prefer_constructors_over_static_methods: warning
  prefer_contains: warning
  prefer_const_constructors: warning
  public_member_api_docs: warning
  cancel_subscriptions: warning
  always_put_required_named_parameters_first: warning
  avoid_equals_and_hash_code_on_mutable_classes: warning
""";
}