hardcoded_strings 0.0.2+1 copy "hardcoded_strings: ^0.0.2+1" to clipboard
hardcoded_strings: ^0.0.2+1 copied to clipboard

Linter which notifies if the user is using hardcoded strings or invalid Ditto keys

hardcoded_strings #

This is a linter built with custom_lint which will find all the hardcoded strings inside your widget and the keys which are not contained inside Ditto.

Installation #

To install this linter you have to add it in your pubspec.yaml as follows:

dev_dependencies:
  custom_lint:
  hardcoded_strings:

and then, in your analysis_options.yaml:

linter:
  plugins:
    - custom_lint

First run #

To get the linter run you firstly have to download your localizations with

flutter pub run hardcoded_strings -a <YOUR-API-KEY>

and all the keys you have in your workspace will be downloaded in the file ditto_keys.json which will be read from the linter.

Configuration #

You can configure this linter by addind some keys inside your analysis_options.yaml. Available keys are listed down here, and all of them are optional.

hardcoded_strings:
  # Integer value that defines the min length of the string to be evaluated
  min_lint_length: 0
  # All keys below accept values in (info, warning, error)
  lint_levels:
    # Specifies how should be considered the strings that are invalid Ditto keywords, i.e. the keys
    # not contained in the file generated during the first run
    invalid_ditto_keyword: error
    # Specifies how should be considered the hardcoded strings inside your widgets
    hardcoded_string: warning
3
likes
100
points
26
downloads

Publisher

verified publishersmaso.it

Weekly Downloads

Linter which notifies if the user is using hardcoded strings or invalid Ditto keys

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

analyzer, analyzer_plugin, args, custom_lint_builder, flutter, freezed_annotation, http, json_annotation, mutex, path, yaml

More

Packages that depend on hardcoded_strings